Need to to capture a grid column value, using the onchange event.

Dynamics 365 8.2.3,

We are running Dynamics 365 8.2  and having an issue with editable grids.  When using the editable grid, XRM.Page is not supported so code to summarize grid data and update a field on the parent form only works when the form is Refreshed, not when the value is edited “in-line”.

I can make this work, but I need to to capture the grid column value, when changed on the “onchange” event.

According to the documentation I have found, the code examples seem to utilize Dynamics 365.  I’m not sure the Javascript we have supports the examples I have seeing online…specifically the “getFormContext”

Please review the code below and let me know what I need to change.

Thanks

function pvalue(context) { 
    alert("here");  //this works
 
    var estimatedvalue = context.getFormContext().data.entity  // this does not
    var val = estimatedvalue.attribute.getByName("ring_estimatedvolume");
    alert(val.getValue()); 
}
 

Open in new window

LVL 1
apollo7Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Zakaria AcharkiAnalyst DeveloperCommented:
but I need to capture the grid column value when changed on the “onchange” event.

Not sure but I think you need to attach a change event instead in you JS code like :

document.querySelector("[name='ring_estimatedvolume']").addEventListener('change', function(e){
    alert(e.target.value);
})

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
apollo7Author Commented:
Thank you, we will test this and get back with any questions.
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi,

Your code looks good and it should work. Can you specify your attribute is of which type?
apollo7Author Commented:
This change event solved the problem
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Dynamics

From novice to tech pro — start learning today.