How to create a pre-Image for a subgrid fields in dynamic 365 RRS feed

  • Question

  • Hi all,

    I am creating a plugin that changes the field of a subgrid(child record) in dynamic 365 using a plugin, Yes the plugin updates the field, but how do i create a preimage that returns the child records to its orevious state, when the checkbox that update the child record is unchecked to return the child record back to its previous state. My code is below:

    if (approvalRequest.ukn_markallopcheckspass.Value)
                        QueryExpression appChkAns = new QueryExpression(ukn_approvalcheckanswer.EntityLogicalName);
                        appChkAns.ColumnSet = new ColumnSet(true);
                        appChkAns.Criteria.AddCondition("ukn_approvalrequestid", ConditionOperator.Equal, entity.Id);
                        EntityCollection approvalCheckAnswer = service.RetrieveMultiple(appChkAns);
                        foreach (var retrievedAppAns in approvalCheckAnswer.Entities)
                            if (retrievedAppAns != null)
                                int pass = 968200001;
                                EntityReference sAppCheckQuest = retrievedAppAns.GetAttributeValue<EntityReference>("ukn_approvalcheckquestion");
                                ukn_approvalcheckquestion checkQuestion = (ukn_approvalcheckquestion)service.Retrieve(sAppCheckQuest.LogicalName, sAppCheckQuest.Id, new ColumnSet(new string[] { "ukn_name" }));
                                if (checkQuestion != null && checkQuestion.ukn_name != null)
                                    if (checkQuestion.ukn_name != "Any distribution netted off")
                                        retrievedAppAns["ukn_decision"] = new OptionSetValue(pass);
                                        approvalRequest.ukn_markallopcheckspass = false;
                                    else return;


    Tuesday, July 30, 2019 11:19 PM


All replies