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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Retrieve the currency field value from contact (ie) lookup field in account entity and must show the contact currency field value should update while saving in account entity currency field save using plugins

(0) ShareShare
ReportReport
Posted on by

hi  can anyone tell me how to Retrieve the currency field value from contact (ie) lookup field in account entity and must show the contact currency field value should update while saving in account entity currency field  save using plugins . 

I have the same question (0)
  • Suggested answer
    Vipin J Profile Picture
    1,603 on at

    You need to write a java-script code

    • on the change of contact lookup on account entity
    • on the form load of account entity

    Code will try to get associated currency value which is set on contact record and set the value in account entity form.

    Refer following

    https://vjcity.blogspot.com/2019/07/how-to-get-and-set-value-for-different.html

    https://vjcity.blogspot.com/2019/08/guidelines-to-write-good-javascript.html

    If you change the currency value on Account entity, then you can update the currency value on contact entity from java-script.

    You should go for Plugin if these operations are being done to CRM from external end.

  • Community Member Profile Picture
    on at

    I am stuck in it i retrieved the account and contact after that i need to retrieve attribute Money from contact and update in Account money Field .  here is my plugin code 

    namespace Moneyretrieveing
    {
    public class Class1 : IPlugin
    {
    private object entity;
    private object targetEntity;

    public object guidAccountId { get; private set; }

    public void Execute(IServiceProvider serviceProvider)
    {
    IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
    IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
    IOrganizationService service = factory.CreateOrganizationService(context.UserId);
    QueryExpression queryAccounts = new QueryExpression("account");
    queryAccounts.ColumnSet = new ColumnSet(true);
    EntityCollection Accounts = service.RetrieveMultiple(queryAccounts);
    QueryExpression queryAccounts1 = new QueryExpression("contact");
    queryAccounts1.ColumnSet = new ColumnSet(true);
    queryAccounts1.Criteria.AddCondition("parentcustomerid", ConditionOperator.Equal, new Guid("7C23E73A-2A4E-EA11-A812-000D3AF26E41"));
    EntityCollection contacts = service.RetrieveMultiple(queryAccounts);
    queryAccounts.ColumnSet = new ColumnSet("primarycontactid");
    EntityCollection retrieved = service.RetrieveMultiple(queryAccounts1);
    if (queryAccounts1.Attributes.Contains("new_money"))
    {
    Money money = (Money)((contacts.Attributes["new_money"]));
    }
    for (int i = 0; i < retrieved.; i++)
    {


    }


    }
    }
    }

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans