Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Updating fields with Java

Posted on by Microsoft Employee

Hi all, 

I'm looking at updating a field on one of our custom entities. It's a simple field that I wish to update. Basically the criteria is: 

If field x from contact entity contains data, change field y in our custom entity, from its default, "no" to a yes. 

I have this functioning with a workflow, however in order to see that the field has been updated, you'd need to perform a refresh of the page, which isn't viable for our CS staff. 

Thanks all in advance

*This post is locked for comments

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Updating fields with Java

    Actually, you can simply do this:

    - in the grid onload, use gettotalrecordcount to see if there are contact records

    - then set you yes/no field to yes if there are records

    No need to refresh(may still want to keep the workflow if a contact's parent is updated through the contact form)

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Updating fields with Java

    If you are adding a contact through a subgrid, then you might try this:

    - make your workflow a real-time workflow(if it's not)

    - add grid onload event - just refresh data on the form:

    [View:https://msdn.microsoft.com/en-us/library/dn932126.aspx#BKMK_GridControlOnLoadEvent]

    (For the refresh, check this:

    [View:https://msdn.microsoft.com/en-us/library/dn481607.aspx#BKMK_refresh] )

  • Verified answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Updating fields with Java

    Hi,

    You could try writing a Javascript on-load of the form of the custom entity.

    function onLoad() {
        var x = Xrm.Page.getAttribute("xattributename").getValue(); //Get the value of the attribute x
        if (x != null) {
            Xrm.Page.getAttribute("yattributename").setValue(true); // Set the value of the two option attribute y
        }
    }

    Hope this helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Updating fields with Java

    Thanks for your reply Alex.

    Ah, I see. So the minute the contact record is added to the custom entity, and if that contact record has x option set, change the field on the custom entity, from a no, to a yes.

    I hope that explains it a bit more clearly. Additionally I've included a screenshot of the workflow I've created to perform this task.

    http://imgur.com/a/LfIT1

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Updating fields with Java

    Hi,

     how is it supposed to work? If you open your custom entity, how and where are you going to change the field on the contact (in other words, at which point would you need to display "yes" in the custom entity form?)

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