Error Creation has been canceled.

Hello all,

I have to create Hr applicant from visual studio web site.

For that I created One Query and create document service . write code below to create applicant website .

when I run this ,it gives me error “Creation has been canceled”

so please tell me how can I solve the problem and create applicant.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ServiceReference1;
using System.Text;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{

string FName;
string Mname;
string LName;
int count = 0;

AxdApplicantQ CreateApplicant = new AxdApplicantQ();
ApplicantQServiceClient client = new ApplicantQServiceClient();
AxdEntity_HcmApplicant hcmApplicant = new AxdEntity_HcmApplicant();

AxdEntity_DirPersonName dirPersonname = new AxdEntity_DirPersonName();

AxdEntity_DirPerson_DirPerson dirperson = new AxdEntity_DirPerson_DirPerson();
AxdEntity_DirPersonName dirpersonname = new AxdEntity_DirPersonName();

CallContext callcontext = new CallContext();

//AxdEntity_InventDim inventDim = new AxdEntity_InventDim();

EntityKey[] keys = new EntityKey[1];

EntityKey key = new EntityKey();
KeyField field = new KeyField();
hcmApplicant = new ServiceReference1.AxdEntity_HcmApplicant();
hcmApplicant.DirPerson = new AxdEntity_DirPerson_DirPerson[] { dirperson };
dirperson.DirPersonName = new AxdEntity_DirPersonName[] { dirpersonname };
CreateApplicant.HcmApplicant = new AxdEntity_HcmApplicant[] { hcmApplicant };

FName = TextBox1.Text;
Mname = TextBox2.Text;
LName = TextBox3.Text;

dirPersonname.FirstName = TextBox1.Text;
dirPersonname.MiddleName = TextBox2.Text;
dirPersonname.LastName = TextBox3.Text;
TextBox4.Text = TextBox1.Text + “” + TextBox3.Text;
dirperson.NameAlias = TextBox4.Text;

callcontext.Company = “USMF”;
callcontext.Language = “en-us”;

keys = client.create(callcontext, CreateApplicant);

key = keys[0];
field = key.KeyData[0];
count++;
}
}

Thank You.

Which call does throw the error?

I expect that the error is thrown from AX, therefore you should debug X++/CIL code, not the C# code you showed above.

Thank you for your reply.

I generate full CIL ,also restart service of Ax .But still I got same error when I call entity key variable .

so can u please give me another solution for this problem.

I said that your code in AX gets called but it throws an error as some point. I’m not surprised that CIL generation and AOS restart changed nothing at all; that’s why I didn’t suggest anything like that.

If code throws an error, the usual approach is to debug the code.

You also forgot to answer my question.