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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Javascript for Editable Grid

(0) ShareShare
ReportReport
Posted on by 1,299

Hi Experts,

I am trying to write a Javascript on the Editable grid(of opportunity product) that gets triggered onrecordselect. I want to get data from the related record and based of that manuplate the editable grid.

Ex. We have a custom field on the product called "New" which is "Yes" or "No", I want to retrieve the value of the field in the javascript so that i can manipulate the editable grid based of that.

The code that i have now is able to select or read data from the selected row which is "Opportunity product", from here how to i read "Product" (Existing product) which is a lookup- a related entity. Please help me out

function gridRowSelected(executionContext) {
var selected = executionContext.getFormContext().data.entity;
var Width= selected.attributes.getByName("as_width").getValue();
}

Thanks in advance for your response.

I have the same question (0)
  • PabloCRP Profile Picture
    1,088 on at

    Hi, Davyjones .

    where is the lookup in the editable grid?, can you add that field to the view that is using your grid?

    then you could do the same as you are doing

    data.entity.attributes.getByName("NAME_OF_THE_FIELD").getValue(), and it'll give you a array with an object as result.

    Regards.

  • Davyjones Profile Picture
    1,299 on at

    Hi Pablo,

    Thank you for your response.

    I added the lookup in the editable grid in the view and i was able to get the array, but the array did not have all the fields on the record, rather it had only the name, id and the array pointer.

    Please help.

  • Verified answer
    PabloCRP Profile Picture
    1,088 on at

    Hi, Davyjones

    You'll get just those 3 items form a lookup, for getting more data use Xrm.WebApi

    function foo(){
    var selected = executionContext.getFormContext().data.entity;
    var lookUpGrid = selected.attributes.getByName("NAME_OF_THE_FIELD").getValue()?.[0];
    if(lookUpGrid===undefined)
        return;
    Xrm.WebApi.retrieveRecord(lookUpGrid?.entityType,lookUpGrid?.id).then(
    function(res)
    {
        //your record will log with a lot of fields.
        console.log(res);
    },
    function(err)
    {
        //something gone wrong.
        console.log(err);
    });
    
    }

    Regards.

    please consider marking as an answer if it was helpful

  • Davyjones Profile Picture
    1,299 on at

    Thanks for your response and help. Appreciate it a lot

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
ManoVerse Profile Picture

ManoVerse 55 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans