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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Perform certain action...
Power Pages
Unanswered

Perform certain action in Entity Form by taking LookUp value from content snippet

(0) ShareShare
ReportReport
Posted on by 57

Hello,

 

I am hiding/showing some fields in Entity form based on a Lookup value selection. As an example - From the developer tools, I can see the following in Elements - <option value = <"xxx-ssss-ffff-sss">Icecream</option>

 

Hence when I am writing the following code onchange event - 

if($(#fieldname1).val()="xxx-ssss-ffff-sss")

{

$("#fieldname2").closest('tr').hide().

 

This code works perfectly fine, however I am forced to hardcode "xxx-ssss-ffff-sss" into the Entity form javascript to perform some conditional checks. Can you please guide me how can I leverage content snippet to store value of Icecream and use content snippet in my entity form or how can I use fieldname value as Icecream in my code?

 

@ragavanrajan  @OOlashyn @ulrikke @OliverRodrigues 

Categories:
I have the same question (0)
  • oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    I think best one for you to use here would be Site Settings instead of Content Snippets.

    Simply create a new Site Setting for each of your Values (I am assuming they are GUIDs) and then reference it by name, you can call a Site Settings using the following: 

    var draftGuid = '{{ settings["MY SITE SETTING NAME"] }}';

    In addition, if your "IceCream" table is some sort of domain data/master data, and not transaction data, I would highly recommend that you move your data keeping the same GUID in every environment, and then you can safely reference/hard-code the GUID in your code.

    You can use the configuration migration or a few tools in XrmToolbox for transferring data (I personally like the Data Transporter, very easy to use)

  • Pruss10 Profile Picture
    57 on at

    Hi @OliverRodrigues , thanks for your quick response. I can try that. One thing, though, Icecream is not the table, it is the value of the lookup field associated with the GUID - xxx-ssss-ffff-sss. So, instead of "xxx-ssss-ffff-sss", I want to put "Icecream" in my code, either through content snippet or through site settings. Reason being, I guess the GUID "xxx-ssss-ffff-sss" may not remain same for value Icecream across Dev and Prod environments. If it is not possible to use Icecream as value in my code, then only I would prefer to use the GUID in site setting/content snippet.

  • Verified answer
    Fubar Profile Picture
    8,338 Super User 2025 Season 2 on at

    If you have such data I would recommend making the GIUD the same between environments.

     

    All you need to do is Export to Excel. Unhide the first 3 columns (first column is the GUID), copy into another file (csv or XML 2003) and then Data Import it into the other Environments (when you do the mapping you set the GUID field to the item called Primary Key).  We normally copy the records we want and remove Column B & C and give Column A a name such as ID).

     

    Alternatively you can use the Configuration Data Management Tool (the same one you use to move the Portal between environment), but as it has no filter capability it means your source has to be clean. when you setup the Schema File you tell it to include the guid field.

     

    Or XrmToolBox has a tool that will allow you to move records with their GUID's - it does have the capability to filter.

     

    (config/reference type data regularly has the same Giuds between environments because if you then use it in a workflow or flow, or have to hardcode it in JavaScript you don't have to make updates to those items when you move them between environments)

     

  • Verified answer
    oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    @Pruss10 so if your icecream value is represented by a lookup/GUID, it is coming from a table/entity from your Dataverse/CDS. 

    Unless users will create manually records there, I would recommend that they are always created by the DEV team, and moved across with the same GUID

  • Pruss10 Profile Picture
    57 on at

    Thank you @OliverRodrigues and @Fubar !!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard