web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

JavaScript Programming in Dynamics 365

(0) ShareShare
ReportReport
Posted on by

Hi Seniors, 

Folks, I am new to JavaScript programming, but functional certified in D365 CRM, now wants to make bit of programming skills as well: I need help to code following scenario:

I have two entities :

Entity A -> Attributes -> CalibrationID (Number), Name (Single Line Text), Calibration Min (Float Number),  Calibration Max (Float Number)

Entity B -> Attributes -> ID (Number), Machine Name (Single Line Text), CalibrationID

Entities have One(Entity A) to Many(Entity B) relationship.

Now on form of entity B, I want when user selects from CalibrationID lookup(which showing Calibration Name actually), system shows Calibration Min and Max value which are actually fetched from Entity B according to selection 

(I know its very common task for seniors but for me its Sky Scrapper ;) If somebody can suggest code with help to understand it will be a great help.

I have one more question as well, Is trial D365 online instance pre-configured for programming, I mean when somebody use xrm.page etc etc in javaScript code does xrm(SDK) is referenced somewhere already (which we used to do manually in c# programming by the use of 'using' keyword , if not how we can do it??

Any help, will be a great help :)

Cheers

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hello Imran,

    If my understanding is correct,  you want to display Min and Max value in the lookup view of entity A with Name. So to do this you can change the lookup view by going to Settings-》 customization-》customize the system or solution-》 Expand entity -》 find entity A -》go to views  -》select lookup views-》 Add columns-》 select Min and Max colum --》Save and close-》Publish all customization.

    [View:https://ledgeviewpartners.com/blog/customize-lookup-views-in-dynamics-crm/]

    In other way  you can also configure quick view form to display related entity data.

    [View:https://technet.microsoft.com/en-us/library/dn531145.aspx]

    [View:https://www.powerobjects.com/2013/09/09/exploring-quick-view-forms-in-crm-2013/]

    For your second question you are correct for client side javascript code you don't need any reference it's system defined.

    But for c# you need to take the reference.

    Hope this helps.

  • Suggested answer
    Shahbaaz Ansari Profile Picture
    6,211 on at

    H Imran,

    You can do it by OOB functionality that is Quick View form instead of JavaScript code,

    Take a look at the video, how you can create Quick view form

    www.youtube.com/watch

    Thanks,

    Shahbaaz

  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    Hi Imran,

    I think you already know the logic. You need to get the selected lookup in Entity A, then retrieve the entity itself by the id.

    For retrieving, you can learn Crm WebApi https://msdn.microsoft.com/en-us/library/mt593051.aspx?f=255&MSPPError=-2147217396

    The Xrm object already loaded by CRM itself. You can test in when you open F12, you can get the object using either frames[0].Xrm.Page or frames[1].Xrm.Page in console to check the object. But when you write a code in javascript, you directly remove frames[0]/frames[1] because your code will run in the same frame.

    For this task you will need:

    Xrm.Page.getAttribute("entity_lookup_a").getValue()

    For accessing the id for selected lookup data:

    Xrm.Page.getAttribute("entity_lookup_a").getValue()[0].Id

    For setValue:

    Xrm.Page.getAttribute("attributename").setValue(val)

    Happy coding.

  • Community Member Profile Picture
    on at

    Thanks all of you guys for help, mate this is kind a assignment for me so I have to do this task only using javascript, Special thanks to Wahyu Raharjo, its the nearest answer to my problem, guys I am trying to code it, kindly suggest me one more thing, which editor I have to use for javaScript that can give me intellisense as its very helpful for the new programmer like me. I am trying to use visual studio but its not giving me intellisense, when I write xRM it not recognize it, what I am missing? or is there any other editor (Desktop or Web) which I can use to have full intellisense?

    Thanks once again for help.

    Imran

  • Community Member Profile Picture
    on at

    Hello hi!

    I am a newbie here, too :)

  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    Hi Imran,

    Unfortunately there is no intellisense for Javascript client side. Usually my default IDE still visual studio because whenever I do changes, I need tfs for get latest and open the file. But you can also use Notepad++ or vscode.

    For testing purpose the only thing you can is playing with F12 (Console) to test something. You can test using frames[0].Xrm.Page.getAttribute("attributename") or sometimes in frames[1].Xrm.Page.getAttribute("attributename") instead of debugging which will cost lot of memory in your computer.

    Hope this help.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans