Asked by:
CRM2011 Custom Activities-Mark as Complete not working

Question
-
Two issues with the Mark as Complete button with custom activities in CRM2011 on premise. It doesn't operate the same as OOTB activities. These two issues are:
- It doesn't close the window
- It doesn't refresh two sub-grids on the Contact form (Open Activities and Closed Activities)
Any supported solutions to this?
Does anyone know if this is fixed in any later roll-ups?
Tuesday, November 19, 2013 12:51 AM
All replies
-
Hello,
This is by design only, you need to write code manually close form after it is completed.
you could overwrite mark as complete button and call your custom js function on it.
check:
http://mahenderpal.wordpress.com/2011/07/01/close-ms-crm-2011-form-using-js/
you can also use js to refresh subgrid as well.
Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.- Edited by HIMBAPModerator Tuesday, November 19, 2013 1:03 AM
- Proposed as answer by Anubhav Bajpai Tuesday, November 19, 2013 5:37 AM
Tuesday, November 19, 2013 1:02 AMModerator -
Thanks heaps for your help. I overwrote the existing MSCR function of the button:
<CommandDefinitions>
<CommandDefinition Id="Mscrm.SavePrimaryActivityAsComplete">
<EnableRules />
<DisplayRules />
<Actions>
<JavaScriptFunction FunctionName="SaveAsCompleted" Library="/_static/activities/activity.js" />
<JavaScriptFunction FunctionName="closeAfterMarkCompleted" Library="$webresource:ract_/Script/ActivitiesMarkAsComplete" />
</Actions>
</CommandDefinition>
</CommandDefinitions>
But now the 'Mark as Complete' button appears on every form. Do you know how I can create a display rule in the xml to show only on activity entities?
Also I am unsure how to add the javascript to refresh the sub-grid on the parent contact form? Any ideas?Tuesday, November 19, 2013 6:39 AM -
Hello,
you could use http://msdn.microsoft.com/en-us/library/gg327898.aspx to show your button only for activity entity, or you could only modify entity ribbon for your entity then you don't need this rule.
to refresh your subgrid you can use below code, you can bind this code to some event on your parent form when you want to refresh sub grid
gridControl = Xrm.Page.ui.controls.get("SubGridName");
gridControl.refresh();Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.Tuesday, November 19, 2013 10:03 PMModerator