Sales Opp. data Into Service Call And Service Call ID back Into original Sales Opp. UDF?

Desmond

Hi,


 


I need some help please.


 


I have no problem opening a Service call from a Sales Opportunity and copying all the data I want over to the Service Call. However what I need is to be able to copy that newly opened Service Call ID back over to the original Sales Opportunity into a UDF field I use for my service Call IDs.


 


This is the cscode I am using to get my data from the Sales Opportunity into the Service Call. Now how do I get the Service Call ID back into that Sales opportunity?


 


Thanks!



// read information from Sales opportunity

String cardCode = TextEdit.GetFromUID(pVal.Form, "9").Value;
String boNumber = TextEdit.GetFromUID(pVal.Form, "74").Value;
String opDescription = TextEdit.GetFromUID(pVal.Form, "137").Value;
String subject = "BO" + boNumber + " - " + opDescription;

// open service call form (menu id 3587)

Menu.MainMenu.Activate("3587");
Form scForm = Form.GetFormFromUID(SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.ActiveForm.UniqueID);
// write data to the service call form

TextEdit.GetFromUID(scForm, "14").Value = cardCode;
TextEdit.GetFromUID(scForm, "NI_00055").Value = boNumber;
TextEdit.GetFromUID(scForm, "6").Value = subject;

Desmond

Ok, I manage to get it working somehow. But I am sure there must be a better more correct cleaner and simpler way to do this?


 


Any suggestions?



{
// read information from sales opportunity

String cardCode = TextEdit.GetFromUID(pVal.Form, "9").Value;
String boNumber = TextEdit.GetFromUID(pVal.Form, "74").Value;
String opDescription = TextEdit.GetFromUID(pVal.Form, "137").Value;
String subject = "BO" + boNumber + " - " + opDescription;

// open service call form (menu id 3587)

Menu.MainMenu.Activate("3587");

Form scForm = Form.GetFormFromUID(SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.ActiveForm.UniqueID);
String scNumber = TextEdit.GetFromUID(scForm, "12").Value;

// write data to the service call

TextEdit.GetFromUID(scForm, "14").Value = cardCode;
TextEdit.GetFromUID(scForm, "NI_00055").Value = boNumber;
TextEdit.GetFromUID(scForm, "6").Value = subject;

// open sales opportunity form (menu id 2566)
// change document mode to find (menu id 1281)
Menu.MainMenu.Activate("2566");
Menu.MainMenu.Activate("1281");

Form soForm = Form.GetFormFromUID(SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.ActiveForm.UniqueID);

// write data from boNumber variable to the sales opportunity

TextEdit.GetFromUID(soForm, "74").Value = boNumber;

// update sales opportunity to find original document

pVal.Form.Update();

// write data from service call into selected sales opportunity

Form boForm = Form.GetFormFromUID(SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.ActiveForm.UniqueID);

TextEdit.GetFromUID(boForm, "NI_00099").Value = scNumber;
}

0

Comments

0 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

New post