Guy
Guy

Reputation: 158

"Close" custom entity button

I've built a custom entity in Dynamics CRM. I'd like it to have functionality similar to the opportunity entity, Close as Won or Close as Lost, only this language would be Approved or Denied.

Approved button would set the status to "Approved" and make the entity read only.

Denied button would set the status to "Denied" and make the entity read only.

I've done some research and looked into ribbon workbench, but I've got no idea on how to actually make it lock the entity when the button is pressed. The only tutorial I've found makes it open a webpage, and I'm not sure how to hack that into doing what I want it to do.

Any suggestions or places to read up on how to do this? Thanks!

Upvotes: 2

Views: 1056

Answers (2)

Mauro De Biasio
Mauro De Biasio

Reputation: 1146

the request is a little bit generic. I'll try to help. First of all, when people "accept" or "denied" the new entity you created, do you want to deactivate the record? In crm when an opportunity is closed it becomes not editable because it's deactivated. To achieve that you should use the internal status, "active" or "Inactive". So you can catch the event with a plugin and set the status to disable/enabled. You can managed this case client side too, you can read the field that you are setting as "enable/disable" and put all the fields on the form in read only. The third option is to use a synchronous workflow, read a specific field, put a condition and change the status of the record based on that condition.

Whatever road you choose a little bit of work is involved :)

Upvotes: 1

Zach Mast
Zach Mast

Reputation: 1718

I think your question is fine. Instead of having the button open a webpage you can have it call a plugin (using javascript) which updates the instance of the entity that you are viewing. Intuitively it might make sense to just set your record to inactive when the "Denied" button is pressed which also has the side effect of disabling fields.

In this related post the second option is what I am referring to.

Upvotes: 1

Related Questions