Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Java script code for special access

Posted on by Microsoft Employee

Hi experts, I need code for user X in this situation:

X can Create and Read Form A in Status reason 0,

but when status Reason change to 1 and the owner is not equal to X, X only can change status reason and All form A is disabled except Status reason.

Can U help me for writing js?

*This post is locked for comments

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Java script code for special access

    Hi,

    You can take a look  : 

    Plugin Development for Dynamics 365.

    Step by Step Youtube.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Java script code for special access

    Hi Roya,

    You can implement below java-script  code in your form on load event, and inside for each you need to check the status field with your condition . Hope this helps

    function MarkAllFieldReadOnly() {

    Xrm.Page.ui.controls.forEach(function (control, index) {

    try{

    control.setDisabled(true);

    }

    catch (e)

    {

    }

    });

    }

    Mark it as answer if this helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Java script code for special access

    the problem is I don't know how i can create plugin and also use it.

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Java script code for special access

    Hi,

    if using JavaScript , user can easily "hack" through using file import or bulk edit. So, plugin would be more suitable in this case , throw some meaningful message when necessary

  • Suggested answer
    Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: Java script code for special access

    Hi Roya,

    I recommend that you should do with plugin, because javascript works client-side and easy to disable / hack.

    You should register your plugin on pre-validation or pre-operation step and retrieve your record data (with IOrganizationService.Retrieve) and check your logic. If data not matched with your business steps throw an exception inside plugin.

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans