Hi experts,
I have used custom scripting to create a custom phone call activity onSave of form. I am trying to set value of new_timer into a a custom field I have created in phone call activity form but it is not setting the value.
/*This function will help to create PhoneCall Activity entity Record*/ function TaskCreation() { //get Current Logged in User name var UserName=Xrm.Page.context.getUserName(); //get Logged is user GUID var UserId=Xrm.Page.data.entity.getId(); //Get Current timer value var TimerValue = Xrm.Page.getAttribute("new_timer").getValue(); //Get Current Computer Time var CurrentTime = Xrm.Page.getAttribute("new_currenttime").getValue(); //Get Primary Contact var con = Xrm.Page.getAttribute("customerid").getValue(); //Set Task Activity Entity record var Task = {}; Task.Subject = "Call Timing of User "+UserName; //set task subject Task.Description = "Call Running Time: "+TimerValue+"\nUser Name: "+UserName+"\nCall date: "+CurrentTime; //set Task Description Task.Description.new_duration = "TimerValue"; //set Task Duration Task.RegardingObjectId = { Id: Xrm.Page.data.entity.getId(), LogicalName: 'incident'}; //set parent entity type var activityParties = new Array(); var partyObj0 = new Object(); partyObj0.PartyId = { Id: con[0].id, LogicalName: con[0].entityType }; partyObj0.ParticipationTypeMask = { Value: 1 }; //Setting "From" of Phonecall activityParties[0] = partyObj0; var partyObj1 = new Object(); partyObj1.PartyId = { Id: con[0].id, LogicalName: con[0].entityType }; partyObj1.ParticipationTypeMask = { Value: 2 }; //Setting "To" of PhoneCall activityParties[1] = partyObj1; Task.phonecall_activity_parties = activityParties; //set activityParties //finally create Task SDK.REST.createRecord(Task,"PhoneCall", function (Task) { writeMessage("The phonecall with Subject \"" + Task.Subject + "\" was created"); },errorHandler); //Error handling function errorHandler(error) { writeMessage(error.message); } } I am trying to store TimerValue from case record into new_duration field in phone call record but it it not setting. Please see code in pink
Thanks,
Jon
*This post is locked for comments