Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Error 0x83215605 & 0x83215603 on working script since change to UCI

Posted on by 70

Hi all,

Hoping I can get some advice with this, having an issue since we've switched our test environment to force UCI. I had a JS script which was working perfectly beforehand which is supposed to pop up and ask the user if they want to schedule another home visit (a custom activity entity in our solution) on marking an existing one complete. It then opens the Quick Create form for the entity and prefills some fields. Then a workflow is created & run to mark the current record as completed. 

All of these steps still happen in the new environment but the issue is we now get 2 error pop ups, with codes 0x83215605 (opens as soon as initial record is marked complete) and 0x83215603 (opens when 'Yes' is clicked in the dialog box). Are there any known issues with the Unified Interface affecting scripts in this way? I have searched online but couldn't find anything. Alternatively if there's something amiss in my script I'm more than happy to be corrected! I've pasted my code below and would really appreciate any input or advice. Thanks! 

function onSave(executionContext) {
    var formContext = executionContext.getFormContext();
    var thisEntityID = formContext.data.entity.getId();
    var entityID = thisEntityID.slice(1, -1);
    var eventArgs = executionContext.getEventArgs();
    var saveMode = eventArgs.getSaveMode();
    if (saveMode === 58) { //Mark as complete
        eventArgs.preventDefault();
        var confirmStrings = { text:"Do you want to book in the next home visit for this carer? (Recommended)", title:"Schedule Next Visit?", cancelButtonLabel:"No", confirmButtonLabel:"Yes"  };
        var confirmOptions = { height: 200, width: 450 };
        Xrm.Navigation.openConfirmDialog(confirmStrings,confirmOptions).then(function (success) {
            if (success.confirmed) 
                scheduleNext(formContext, entityID);
                formContext.data.save();
        });
    } else {statusComplete(entityID);}
}

function scheduleNext(formContext, entityID){
    
    formContext.data.save();
    
    var entityFormOptions = {};
    entityFormOptions['entityName'] = 'mfs_homevisit';
    entityFormOptions['useQuickCreateForm'] = true;

    var formParameters = {};
    formParameters['mfs_carer'] = formContext.getAttribute('mfs_carer').getValue()[0].id;
    formParameters['mfs_carername'] = formContext.getAttribute('mfs_carer').getValue()[0].name;
    formParameters['subject'] = 'Test Subject';


    Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
    function (success) {
        console.log(success);
    },
    function (error) {
        console.log(error);
    });
    
    statusComplete(entityID);
  
}

function statusComplete(entityID){
    var entity = {
   "EntityId": entityID //entity ID passed in in function call
};

//alert(JSON.stringify(entity));
 
var WorkflowId = "1B4F8530-D9E7-47F1-BE35-B12DB2068832"; //change status to complete workflow ID
var gc = Xrm.Utility.getGlobalContext();


var req = new XMLHttpRequest();
req.open("POST", gc.getClientUrl() + "/api/data/v9.0/workflows(" + WorkflowId + ")/Microsoft.Dynamics.CRM.ExecuteWorkflow", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function() {
    if (this.readyState == 4) {
        req.onreadystatechange = null;
 
        if (this.status == 200) {
            console.log("Success");
        } else {
            console.log(JSON.parse(this.response).error);
        }
    }
};
req.send(JSON.stringify(entity));

}


Categories:
  • samnunn92 Profile Picture
    samnunn92 70 on at
    RE: Error 0x83215605 & 0x83215603 on working script since change to UCI

    Just wanted to update this thread for anyone facing the same issue - I ended up opening a support case with Microsoft and after a lot of back and forth the agent told me that essentially there is an issue with the preventDefault() method in UCI. He couldn't tell me if or when it would be fixed but to instead use modal driven dialogs (MDD) to achieve the same result (I believe that feature may still be in beta as of now but that was the advice given). Hope that helps anyone else having a similar problem.

  • samnunn92 Profile Picture
    samnunn92 70 on at
    RE: Error 0x83215605 & 0x83215603 on working script since change to UCI

    Hi Leo

    Thanks so much for your reply & help - when you run the code in your environment do you not get an error, even with the statecode===58 check? I have stripped my code right down to this: 

    function scheduleCA (executionContext) {
    
        var formContext = executionContext.getFormContext();
        var eventArgs = executionContext.getEventArgs();
        var saveMode = eventArgs.getSaveMode();
        if (saveMode === 58) { //Mark as complete
            eventArgs.preventDefault();
            var confirmStrings = { text:"Do you want to schedule a follow up care appointment?", title:"Schedule Next Appointment?", cancelButtonLabel:"No", confirmButtonLabel:"Yes"  };
            var confirmOptions = { height: 200, width: 450 };
            Xrm.Navigation.openConfirmDialog(confirmStrings,confirmOptions).then(function (success) {
                if (success.confirmed) 
                    alert("No problem on yes");
                else alert("No problem on no/X");
            });
        } 
    }
    
    

    and I am still getting the same error code. This error code doesn't appear even on my original script if I change the saveMode check to ===1 and save normally - the rest of my code including the openForm and workflow function works perfectly with no errors. I am really stumped at this point and would love to get to the bottom of this so this functionality can go back into our production instance ASAP. 

    Thanks again
    Sam

    EDIT: I have just been fiddling with the script and if I remove the line eventArgs.preventDefault(); the script runs perfectly and doesn't throw the error, so it must be this causing it. However I cannot simply remove it as the form refreshes before the user can select an answer from the dialog! Any ideas?

  • Suggested answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: Error 0x83215605 & 0x83215603 on working script since change to UCI

    Hi partner,
    Since the issue happened when savemode===58, so it means the code after your judge has problems. So I tested the confirm dialog first, and the dialog could show successfully and when I choosed "Yes", I could also run the function in "Success" smoothly.( in my case when clicking yes, then alert "123", it worked).

    community19.png

    So we could be sure that the problem is in your "scheduleNext" function. 

    I suggest that you could test each of your functions individually (In your case, you could test <open quick create form> & <trigger workflow by web api>) and then you may be able to find out the casue of the issue.

    Hope it helps.

    Best Regards,

    Leo

  • samnunn92 Profile Picture
    samnunn92 70 on at
    RE: Error 0x83215605 & 0x83215603 on working script since change to UCI

    Hi Leo,

    Thanks for replying - I have narrowed it down to something to do with 'Mark Complete' as I don't get any errors if I change 

    if (saveMode === 58) // mark complete save mode

    to 

    if (saveMode === 1) // normal save mode

    The whole error message text is as follows: 

    2200000005

    Error code: 0x83215605

    Session Id: 9fdc43b3-71e8-4c01-b6a4-2c5168a5933d

    Activity Id: ae64bf12-fce5-415e-bff4-c40329841c36

    Time: Mon Jun 24 2019 16:38:54 GMT+0100 (British Summer Time)

    I'm running the code on a custom entity we use, however I have also just now tried to implement a similar script on a different (still custom) entity as we will eventually want similar functionality but I am still getting the same error on mark as complete. 

    Thanks for your help 
    Sam

  • LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: Error 0x83215605 & 0x83215603 on working script since change to UCI

    Hi partner,

    Since you could successfully ran this code in your last instance, did you debug your code step by step to find out which code caused these two errors?

    I haven't find any issue in your code, so could you share us the error message so that we could help you better? Or you could also tell us which entity did you add this code in and then we will be able to test your code in our own instance.

    Hope it helps.

    Best Regards,

    Leo

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans