Notifications
Announcements
No record found.
Pretty much everything is in the title.
If you know how to do, please tell me!
Thank You.
*This post is locked for comments
You question is very open-ended. Could you please elaborate on specifics?
But here are some scenarios:
1. If you just want the same buttons you see on the Opportunity record, YES.Use the excellent 'Ribbon WorkBench' and create the same buttons. Have your own custom javascript which decides what action has to take place when you click those buttons.
2. Are you looking for the nice pop-up boxes you see when you click those buttons on the Opportunity record?Again, YES. This is possible, but you have to build your own HTML web-resource which looks that way, as well as have your ownevent handlers for the buttons.The OOB pop-up writes to the OpportunityClose entity. In your case, you will not be doing this.
Let me know more specifics and I can help you with more info.
Cheers!
I'll probably go with option 1 for the moment, I'm not really sure about what I should do yet.
Ideally I would have similar buttons you can find in the opportunity entity, but maybe just the close one, with different images, I really don't know yet, I have to think about it.
So yeah, for the moment, I just want to add a Close button, so the entity cannot be modified anymore, and if possible specify if the process was finished or aborted.
Ok, for some context here, evey custom entity has the 'Status' field.Once you set this to 'Inactive', the form is automatically made read-only by the system.So, this would be one way to ensure that your users cannot 'modify' the record anymore once you 'Close' it.However, in most scenarios, you would want to leave your record status as 'Active', but make the record read-only. To achieve this, do the following:1. Open up the fields for the entity you are working with.2. Find the 'Status Reason' field and add the new options you want there such as 'Close' / 'Lost' etc.Here is some background reading on Status and Status Reason.https://community.dynamics.com/crm/b/briteglobalsolutions/archive/2017/09/11/status-and-status-reason-in-dynamics-crm Once you have defined the new statuses, you would need to create a JavaScript library which has a function that checks the record's status and locks all the fields on the form. (eg: If record status is Lost/Closed, make all the fields locked, so that users cannot modify them)This is the core snippet you need to use: https://stackoverflow.com/questions/28169295/disabling-all-fields-on-a-form-in-crm-2015But instead of 'Xrm.Page', use the formContext parameter (let me know if you need more details on this.)In case you are not familiar with using JavaScript and WebResources, this would be a good place to start: https://msdn.microsoft.com/en-us/library/gg328261.aspxEnsure that the JavaScript function is called OnLoad of the form.So now you have the Statuses and the Script file, all you need are the custom buttons on your form.Simply put, once you click the buttons (Close / Lost), then:1. Set the status field accordingly 2. Save the record using JavaScript. 2. Call the field-locking function (if required.)Use the Ribbon Workbench solution to create the buttons and link your JavaScript functions to these buttons.Follow the steps mentioned here to get this done.https://ribbonworkbench.uservoice.com/knowledgebase/articles/71374-1-getting-started-with-the-ribbon-workbench If you are new to all this, there is a small learning curve. But feel free to ping back for any queries!Happy XRM'ing. Cheers!
I'll definitely check this out in the following days, thanks a lot for your precious help.
Hello Again! Sorry, I was on holidays.
You told me to let you know if I needed more details on the "formContext parameter", and I do!
Should I use it like I would use Xrm.Page?
Thank You
Help me please! :D
This is the code I wrote, following what I read online :
function deactivateMission(executionContext){
var formContext = executionContext.getFormContext();
formContext.data.entity.attributes.foreach(function(attribute,index){
var control = formContext.getControl(attribute.getName());
if (control){
control.setDisabled(true);
}
})
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2