Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Set an attribute of type rich text with value dynamically from a related entity

Posted on by 10

Hello everyone, 

I'm making a plugin and one of the steps is to set the value of "cms_content" attribute of type multiple line text in "contractAgreementClause" entity from attribute "cms_content" of the same type in "Clause" entity .

I'm using the .Attributes.Add method but not sure how to fill it's parameters

This is the code I wrote but it only returns the logical name of the field and not it's content/value

contractAgreementClauseRecord.Attributes.Add(contractAgreementClauseEntity.contractAgreementClausesContent, clauseEntity.content);


Thanks in advance,
Rand

  • Suggested answer
    Haig Liu Profile Picture
    Haig Liu Microsoft Employee on at
    RE: Set an attribute of type rich text with value dynamically from a related entity

    Hi Rand,

    I'm not sure what the names of the entities and attributes are, but based on the names you provided the code should look like this:

    //Directly passes the attribute value of an entity to another entity

    contractAgreementClause["cms_content"] = Clasuse.Attributes["cms_content"]

     

    //Use an intermediate value

    var intermediate = Clasuse.GetAttributeValue<string>("cms_content");

    contractAgreementClause["cms_content"] = "intermediate"

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Set an attribute of type rich text with value dynamically from a related entity

    Hello,

    Don't use Attributes - there is an easier way. If you want to set a field to a value you can use something like:

    record["field"] = "New Value";

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans