Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Created Error message doesn't show

Posted on by 45

Hi All,

I created a error message with javascript. It's not showing when I click the save and close button. How I fix this problem?

Thanks.

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 8,506 Super User 2024 Season 1 on at
    RE: Created Error message doesn't show

    Can you share your requirement ?because if you want to show the error and also need previous values of lookup then custom actions will be the best choice, As we can not get previous values of lookup in JS.

    Thank you,

    Amit Katariya

  • Suggested answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at
    RE: Created Error message doesn't show

    Hi,

    In javascript it is not possible to get old values.

    Just in case we want to get old values then we have to go to plugins.

    Because plugins have a way names as Plugin images Pre and Post images.

  • CRMcrm1 Profile Picture
    CRMcrm1 45 on at
    RE: Created Error message doesn't show

    Hi All,

    I can see my dialog box error even I click saveandclose thank you.

    I have another queston; I want to get the previous value of the lookup field that I changed  for the cancel button of the dialog box.

    var lookupValue = new Array();

         lookupValue[0] = new Object();

         lookupValue[0].id = preSubStatus._msdyn_substatus_value;

         lookupValue[0].name = preSubStatus["_msdyn_substatus_value@OData.Community.Display.V1.FormattedValue"]; // Name of the lookup

         lookupValue[0].entityType = preSubStatus["_msdyn_substatus_value@Microsoft.Dynamics.CRM.lookuplogicalname"]; //Entity Type of the lookup entity

       // set the booking status to previous value

          formContext.getAttribute("msdyn_substatus").setValue(lookupValue);

    I did like that but it still it gives the value i changed.

    Bipin Kumar Pradeep Rai

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Created Error message doesn't show

    Hi,

    Please share your entire code

    Do you have parameter with same name as executionContext for your function?

    Have you selected check to pass execution contrxt as first parameter

    learn.microsoft.com/.../clientapi-execution-context

  • Suggested answer
    CRMcrm1 Profile Picture
    CRMcrm1 45 on at
    RE: Created Error message doesn't show

    I added "executionContext.getEventArgs().getSaveMode(); " but when I debug, it says it's undefined

  • CRMcrm1 Profile Picture
    CRMcrm1 45 on at
    RE: Created Error message doesn't show

    Thank you for response Bipin Kumar

  • CRMcrm1 Profile Picture
    CRMcrm1 45 on at
    RE: Created Error message doesn't show

    Thank you for response Pradeep Rai

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Created Error message doesn't show

    Hi,

    You need to use getSaveMode api to know which save button is clicked

    learn.microsoft.com/.../getsavemode

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Created Error message doesn't show

    Hi,

    Please share your code...

  • Suggested answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at

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