validation & info log in c#


This sample code gives the view of popups info logs in EP using C#

In below example, we need to throw info if the leave is already taken or for leave applicable for girls only. Code as follows:

public Boolean LeaveValidation(string Leavetypevalidate, Int64 EmplId)


AxBoundField StartDate = (AxBoundField)GetField(this.AxGroup1.Fields, “StartDate”);                 int validate;

//Getting the value from the static method written in X++

validate = (int)AxSession.AxaptaAdapter.CallStaticRecordMethod(“Mzk_LeaveHistory”, “LeaveValidate”, Leavetypevalidate, EmplId);

//initiating the inflog

Proxy.Info objInfoLog = new Proxy.Info(this.AxSession.AxaptaAdapter);

//EVEN If we are throwing info log, it will insert the record in C# if they click save, So we are making the button as disable and making it false at the time of info log

AxForm1.AutoGenerateInsertButton = true;

if (validate == 1)


//Info log to throw at top of EP Page

objInfoLog.add(Proxy.Exception.Error, “Leave already taken”);


AxForm1.AutoGenerateInsertButton = false;


else if (validate == 2)


objInfoLog.add(Proxy.Exception.Error, “Leave is applicable for Female Employees only”);

AxForm1.AutoGenerateInsertButton = false;


return true;



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s