Wednesday, 31 July 2019

Change Display name of Managed Field in Dynamic 365


Sometime we need to change the Display name of Managed field in Dynamic 365.

The following code is used to change the Display name of Managed field.  

IOrganizationService orgService = (IOrganizationService)conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;


RetrieveAttributeRequest attributeRequest = new RetrieveAttributeRequest

                {
                    EntityLogicalName = Opportunity.EntityLogicalName,

                    LogicalName = "parentaccountid",

                    RetrieveAsIfPublished = true

                };

                // Execute the request

                RetrieveAttributeResponse attributeResponse =

                   (RetrieveAttributeResponse)orgService.Execute(attributeRequest);

                Console.WriteLine("Retrieved the attribute {0}.",

                   attributeResponse.AttributeMetadata.SchemaName);

                // Modify the retrieved attribute

                AttributeMetadata retrievedAttributeMetadata =

                   attributeResponse.AttributeMetadata;

                retrievedAttributeMetadata.DisplayName =

                   new Label("Bidding To", 1033);

                // Update an attribute retrieved via RetrieveAttributeRequest



                UpdateAttributeRequest updateRequest = new UpdateAttributeRequest

                {

                    Attribute = retrievedAttributeMetadata,
                   

                    EntityName = Opportunity.EntityLogicalName,

                    MergeLabels = false
                   

                };

                // Execute the request

                orgService.Execute(updateRequest);

No comments:

Post a Comment

Read only field , get latest value from read only field in in power app portal

Below line is used to make field readonly in power app portal through js $( "#bdo_relationshiprole_name" ).parent().css( "po...