Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Qucick Create Close Opportunity custom field

(0) ShareShare
ReportReport
Posted on by 160

Hi,

I have added a Custom field (Multi OptionSet) to the Quick Create Close Opportunity Form , But when I add some Value in this field on Quick Create Close form and close it for example as Won, the custom field on Main Form on opportunity wont be updated (doesnt get the value).

Could anybody please help me?

Best regards

  • Elpibato Profile Picture
    Elpibato 160 on at
    RE: Qucick Create Close Opportunity custom field

    Thank you!

    I have used this code and it works!

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Qucick Create Close Opportunity custom field

    Hi Elpibato,

    Because these two fields actually belong to two different entities.

    In addition to workflow/flow/plugin, you could also run custom javascript function at OnSave event of  Quick Create Close Opportunity Form to update the corresponding field of parent opportunity.

    Just replace the first "new_testmultipleoptionset" with name of your own multiple option set of Close Opportunity entity, and replace the second with Opportunity's'.

    function updateParent(executionContext) {
    
      var formContext = executionContext.getFormContext();
      var multiOpt = formContext.getAttribute("new_testmultipleoptionset").getValue();
      var parentOpportunity = getParameterByName("id");
    
      var data =
      {
        "new_testmultipleoptionset": multiOpt.toString()
      }
      Xrm.WebApi.updateRecord("opportunity", parentOpportunity, data).then(
        function success(result) {
          console.log("Updated");
        },
        function (error) {
          console.log(error.message);
        }
      );
    
    }
    
    function getParameterByName(name, url) {
      if (!url) url = parent.window.location.href;
      name = name.replace(/[\[\]]/g, '\\$&');
      var regex = new RegExp('[?&]'   name   '(=([^]*)|&|#|$)'),
        results = regex.exec(url);
      if (!results) return null;
      if (!results[2]) return '';
      return decodeURIComponent(results[2].replace(/\ /g, ' '));
    }

    Run updateParent function at OnSave event:

    pastedimage1600740286205v1.png

    pastedimage1600740305876v2.png

    Note: To update parent opportunity properly, make sure value of multiple optionset of Close Opportunity can map to value of multiple optionset of Opportunity.

    e.g:

    Multiple optionset of Close Opportunity

    Option 1 -> 1000

    Option 2 -> 1001

    Option 3 -> 1002

    Multiple optionset of Opportunity(same)

    Option 1 -> 1000

    Option 2 -> 1001

    Option 3 -> 1002

    Regards,

    Clofly

  • Verified answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Qucick Create Close Opportunity custom field

    Hello,

    That's mostly because opportunity and opportunityclose are different entities. If you want to transfer that multiselect optionset value you will have to design the workflow/flow/plugin that on close of opportunity will copy that field from opportunity close to parent opportunity.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans