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)

get value and set in another fied in portals

(0) ShareShare
ReportReport
Posted on by 250

Hello everyone my name is Taniguchi and im trying to get a value from a field  and set in another field from the same entity. but its not working, can anyone help me?

code that isant working

var entityName= $("#cr14d_contato_entityname").val();
var lookupGUID = $("#cr14d_contato").val();
var lookupValue = $("#cr14d_contato_name").val();
$("#cr14d_contato").change(function(){
$("#msdyn_bookableresource_entityname").val(entityName);
$("#msdyn_bookableresource").val(lookupGUID );
$("#msdyn_bookableresource_name").val(lookupValue );
})

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at

    Hi.. are you on Dynamics 365 forms? or Dynamics 365 Portals Entity Form? those are completely different things

    if you are on Portals.. if you want to set a value to a field during on save / on load you can you Entity Form / Web Form metadata:  community.adxstudio.com/.../entity-form-metadata

    does this help you?

  • TaniSantos Profile Picture
    250 on at

    Thank you, i m on Dynamics 365 Portals Entity Form i am needing to set the value when i fill another field so onchange

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    It looks like  you are setting the value of one lookup field to another. If yes, are these the same entity lookup? If not then it is expected to not work, you can only set the value between same entities (for lookups)

    If these are same entity, please share more details on what's not working? Are you getting error? Did you check browser console (12) for any errors. The code you have shared is just a snippet, please share full code.

    Hope this helps.

  • TaniSantos Profile Picture
    250 on at

    Yes i am setting the value of one lookup in another they are Both in the same entity but This code its no working its not seting the part tô get the value is right but the part after onchange event dont work

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Can you share your full script you have added to the entity form please?

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    BTW, why do you want to copy the same field value to another field? Why do you have 2 fields to store the same data? Can you share some more details on your requirement, may be there is a better way of achieving your requirement rather than writing a script

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Just realized that you are retriving the value outside of the function so the variable must be returning null in side the function. Try below-

    =============

    $("#cr14d_contato").change(function () {

       var entityName = $("#cr14d_contato_entityname").val();

       var lookupGUID = $("#cr14d_contato").val();

       var lookupValue = $("#cr14d_contato_name").val();

       //alert(lookupGUID);

       $("#msdyn_bookableresource_entityname").val(entityName);

       $("#msdyn_bookableresource").val(lookupGUID);

       $("#msdyn_bookableresource_name").val(lookupValue);

    });

    ===================

    Hope this helps.

  • TaniSantos Profile Picture
    250 on at

    Im making an point system in portals using Project service entities like timeentry and projectapproval but my form in timeentries dont work unless i fill two fields, contact and msdyn_bookableresource and they have the same value so i want to set a value in msdyn_bookableresource when contact is fill even using this code it doesnt work i changed one of lookups to an option set by portals. how can i get the value of a lookup field and set in a option set field and a single line text field

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