Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

JavaScript value updating sometime after upgrade to UR 18 in MS CRM 2011

Posted on by 85

Dear Experts,

Recently we have upgraded our CRM version from UR 16 MS CRM 2011 to UR 18 MS CRM 2011 after upgrading we got an issue with one javascript. This javascript will update a field called case status in case entity on resolving the case. But it's not happening some times. Some times field is updating some times it's not updating we are unable to figure out the issue why it's not updating some times. we have checked the internet settings in the IE11 everything seems fine and our organization won't allow other browsers than IE 11. can you give me some suggestions below is my code for your reference

function updatecasestatus(context){

Xrm.Page.getControl("ccs_assignedto").setDisabled(false);
Xrm.Page.getControl("customerid").setDisabled(false);
var savebuttonmode = 1;
var resolvesavebuttonmode = 5;

var crmstatusfield = Xrm.Page.getAttribute("statecode").getSelectedOption().text;

// get Save method by getSavemode(), so for resovle button its '5'.
var savemode = context.getEventArgs().getSaveMode();

if(savemode == resolvesavebuttonmode )
{

var delayinresponse = Xrm.Page.getAttribute("ccs_delayinresponse").getValue();
if(delayinresponse == null || delayinresponse == 'undefined'){
alert('Please provide Delay in Responding details before closing');
context.getEventArgs().preventDefault();
return false;
}

var resolutionaccepted = Xrm.Page.getAttribute("ccs_resolutionaccepted").getValue();
if(resolutionaccepted == null || resolutionaccepted == 'undefined'){
alert('Please provide whether the resolution accepted or not by customer details');
context.getEventArgs().preventDefault();
return false;
}
//end of change

Xrm.Page.getAttribute("ccs_srstatus").setValue(5);
var uguid=Xrm.Page.context.getUserId();
var un=Xrm.Page.context.getUserName();
var date=new Date();
alert(un);

// on submit mode for sr status field
Xrm.Page.getAttribute( "ccs_srstatus" ).setSubmitMode( "always" );
Xrm.Page.getControl("ccs_cust_language").setDisabled(false);

var buttonId = "incident|NoRelationship|Form|Mscrm.Form.incident.MainTab.Actions";
var resolveButton = window.top.document.getElementById(buttonId);

Xrm.Page.getAttribute("statecode").setValue(1);

if(resolveButton != null && resolveButton != 'undefined'){
//searchButton.disabled=true;
resolveButton.style.display="none";
}

//parent.window.location.reload(true);

}


var caseStatus = Xrm.Page.getAttribute("ccs_srstatus").getValue();
if (caseStatus != null && caseStatus != undefined){
if (caseStatus == 1){
Xrm.Page.getAttribute("ccs_srstatus").setValue(2);
Xrm.Page.getAttribute("ccs_srstatus").setSubmitMode("always");
}
}
//End of change

}

Regards,

Mahesh

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans