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 :
Microsoft Dynamics CRM (Archived)

Refresh form after custom button action

(0) ShareShare
ReportReport
Posted on by

Hi all,

I have a command button on my form created in ribbon workbench. this button runs a real time workflow that creates a new record in another entity and also updates a field on the current form.

This all works fine except i also want the current form to refresh afterwards to show the field update rather than having to press F5.

I have a web resource to refresh the form which works as ive tested directly on the form however when i try to run this via ribbon workbench after the workflow command nothing seems to happen.

Not sure what ive done wrong here?

 ribbonwb.jpg

 

 

*This post is locked for comments

I have the same question (0)
  • Royal King Profile Picture
    27,686 on at

    If you have below script in your custom button it will refresh your form

    Xrm.Utility.openEntityForm("entityname",recordGuid);  // replace entityname and guid 

  • ScottDurow Profile Picture
    21 on at

    This should work since actions will execute in sequence, waiting for the previous to complete.

    If you use Xrm.Page.data.refresh(false); it will refresh your form.

    Why don't you simply put this after the call to the Custom Action - since it's probably done via an Async http call?

  • Community Member Profile Picture
    on at

    Thanks but still no luck. The workflow fires but the form does not refresh.

    Javascript web resource is simply as below:

    function refreshform () {

    Xrm.Page.data.refresh(false);

    }

    7144.wf3.png

    Thanks

  • Jharana Baliyar Singh Profile Picture
    2,667 on at

    Hi Terry,

    please try on this below links,

    stackoverflow.com/.../crm-2013-javascript-form-reload-on-attribute-onchange-crashes-on-ie9-10-11-but-w

    www.crmanswers.net/.../the-xrmpagedatarefresh-method.html

    Hope it may help you!!

    Thanks,

  • Community Member Profile Picture
    on at

    Thanks but this does not help. I can refresh the page with no problem. I just cant get it to work via Ribbon workbench after my workflow has run.

  • Community Member Profile Picture
    on at

    Anyone got any other ideas on this one?

  • ScottDurow Profile Picture
    21 on at

    Could you post your ribbon xml and I will take a look.

  • Aileen Gusni Profile Picture
    44,524 on at

    Terry,

    Have you tried using another method:

    missdynamicscrm.blogspot.sg/.../the-difference-xrmpagedatarefresh-vs-crm-utility-openentityform.html

    Thanks.

  • Community Member Profile Picture
    on at

    Terry,

    Wondering if you can trace the sequence of events to find why the page is not refreshing.

    btw, could you please share the screen with the button you placed?

    good luck,

    harihar

  • Community Member Profile Picture
    on at

    Hi Scott, here is the xml. thanks.

    <RibbonDiffXml>

     <CustomActions>

       <CustomAction Id="new.new_opportunities.Button1.Button.CustomAction" Location="Mscrm.Form.new_opportunities.MainTab.Workflow.Controls._children" Sequence="10">

         <CommandUIDefinition>

           <Button Command="new.contact.Form.RunWorkflow1.Command" Id="new.new_opportunities.Button1.Button" Image32by32="/_imgs/ribbon/runworkflow32.png" Image16by16="/_imgs/ribbon/StartWorkflow_16.png" LabelText="$LocLabels:new.new_opportunities.Button1.Button.LabelText" Sequence="10" TemplateAlias="o1" />

         </CommandUIDefinition>

       </CustomAction>

       <CustomAction Id="new.new_opportunities.Button2.Button.CustomAction" Location="Mscrm.Form.new_opportunities.MainTab.Save.Controls._children" Sequence="80">

         <CommandUIDefinition>

           <Button Command="new.contact.Form.RunWorkflow1.Command" Id="new.new_opportunities.Button2.Button" Image32by32="/_imgs/ribbon/runworkflow32.png" Image16by16="/_imgs/ribbon/StartWorkflow_16.png" LabelText="$LocLabels:new.new_opportunities.Button2.Button.LabelText" Sequence="80" TemplateAlias="o2" />

         </CommandUIDefinition>

       </CustomAction>

     </CustomActions>

     <Templates>

       <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>

     </Templates>

     <CommandDefinitions>

       <CommandDefinition Id="new.contact.Form.RunWorkflow1.Command">

         <EnableRules>

           <EnableRule Id="Mscrm.FormStateNotNew" />

           <EnableRule Id="Mscrm.RunWorkflowPrimary" />

           <EnableRule Id="new.new_opportunities.EnableRule2.EnableRule" />

         </EnableRules>

         <DisplayRules />

         <Actions>

           <JavaScriptFunction FunctionName="Mscrm.FormAction.launchOnDemandWorkflowForm" Library="/_static/_forms/form.js">

             <CrmParameter Value="PrimaryEntityTypeCode" />

             <StringParameter Value="76B48F49-DBB3-4784-A103-F6BEE7F52836" />

           </JavaScriptFunction>

           <JavaScriptFunction FunctionName="refreshform" Library="$webresource:new_refresh_form" />

         </Actions>

       </CommandDefinition>

     </CommandDefinitions>

     <RuleDefinitions>

       <TabDisplayRules />

       <DisplayRules />

       <EnableRules>

         <EnableRule Id="new.new_opportunities.EnableRule2.EnableRule">

           <CustomRule FunctionName="displayconverttobid" Library="$webresource:new_convert_to_bid_button" Default="false" />

         </EnableRule>

       </EnableRules>

     </RuleDefinitions>

     <LocLabels>

       <LocLabel Id="new.new_opportunities.Button1.Button.LabelText">

         <Titles>

           <Title description="Convert to Bid" languagecode="1033" />

         </Titles>

       </LocLabel>

       <LocLabel Id="new.new_opportunities.Button2.Button.LabelText">

         <Titles>

           <Title description="Convert to Bid" languagecode="1033" />

         </Titles>

       </LocLabel>

     </LocLabels>

    </RibbonDiffXml>

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans