Adding custom pop up for each problem state change

arundharmabe
Tera Guru

Hello Everyone,

I would like to add a custom pop up based on glidemodal for each problem state change.

I have tried the below script in the OOB Asses UI action, however the custom pop up appearing 2 times in the beginning and one more time it is executing after OOB pop up closed. I want the custom pop up to be executed only once. I tried adding some time delay after my custom pop up but it is still not working.

Can someone check and advice.

 

function onAssess() {
    if (g_form && g_form.mandatoryCheck()) {
        var gm = new GlideModal("glide_prompt", true, 500); //This is the custom pop up that i added
        gm.setTitle("Did you update the next steps?");
        gm.setPreference("title", "If you have updated the next steps then type 'Yes', else type 'No'.");
        gm.setPreference("fieldType", "textarea");
        gm.setPreference("defaultValue", "");
        gm.setPreference("onPromptComplete", function(value) {
                // Only continue if user typed something
                if (value) {
                    var note = "Did you update the next steps? " + value;
                    g_form.setValue("work_notes", note);
                }
            // Load and call the original Assess logic after the modal [OOB one]
            ScriptLoader.getScripts("ProblemModalUIHelpers.jsdbx", function() {
                if (typeof ProblemModalUIHelpers !== "undefined" &&
                    typeof ProblemModalUIHelpers.onAssess === "function") {
                    ProblemModalUIHelpers.onAssess();
                } else {
                    alert("ProblemModalUIHelpers not loaded.");
                }
            });
        });
    gm.render();
}
}
1 ACCEPTED SOLUTION

Thank Vikas for your response.

I was able to identify the issue — it turned out to be caused by a custom client script. Once I disabled that, everything started working as expected.

I really appreciate you taking the time to look into it and test it on your PDI. Thanks again for your support!



Kind Regards,

Arun

View solution in original post

3 REPLIES 3

VikMach
Mega Sage

Hi @arundharmabe,
I tried your script in my PDI the custom modal that you've added comes only once when I click on "Access" button with question "

If you have updated the next steps then type 'Yes', else type 'No'.".
When I say "Yes" or "No" based on whether I have added a user in the Assigned to field it shows the next modal window to insert the Assigned to user.

It looks like it is doing what you would like it to do.

I didn't find modal showing twice or after the OOB modal is closed.

Could you check in PDI and see if it is working as expected?

Regards,
Vikas K

Thank Vikas for your response.

I was able to identify the issue — it turned out to be caused by a custom client script. Once I disabled that, everything started working as expected.

I really appreciate you taking the time to look into it and test it on your PDI. Thanks again for your support!



Kind Regards,

Arun

Pleasure assisting you!
Keep me in your prayers.