Answered by:
Webservices Change Ownership

Question
-
Hi,
I have created an ISV button "Claim" for my custom entity. The button should assign ownership of the entity to the current user (even if the user has read only).
To do this, I have created a javascript function on the form which changes the owner to the current user and Saves the form. However saving does not work if the user has read only rights. Can this be solved if I use webservices to assign ownership? If yes.. how please?
Thank you
Darren
Darren MerciecaTuesday, April 19, 2011 12:04 PM
Answers
-
You cannot do this directly since the security permissions would exist even for the web services. You could however achieve this using a middle man, or application in the middle.
Here is how it would work, and actually I can think of two potential ways to make this work.
1. You would create a separate web-service application on the CRM server in a different website (but on the same box) that allows client script calls. Now you can send soap envelopes to that service from the jscript behind your button, that app would use a different user context or impersonation and call the web service methods you are looking for.
2. You could probably create a custom entity and give all your users write access to it, then you could illicit an update call on that entity (could be on any instance of the entity) using a jscript call from behind the button. You would attach a plugin to the update message of that custom entity that used impersonation or ran in a different users context to then perform the claim action against the web service.
I hope you find this helpful.
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Tuesday, April 19, 2011 3:05 PM
- Marked as answer by darrmerc Friday, May 13, 2011 8:27 AM
Tuesday, April 19, 2011 1:20 PMModerator
All replies
-
As read only users may access CRM information but may not make any edits or updates to it therefore I think you might not be able to acheive this.
Regards FaisalTuesday, April 19, 2011 1:02 PM -
Even if I use a webservice call to change ownership?
Darren MerciecaTuesday, April 19, 2011 1:17 PM -
You cannot do this directly since the security permissions would exist even for the web services. You could however achieve this using a middle man, or application in the middle.
Here is how it would work, and actually I can think of two potential ways to make this work.
1. You would create a separate web-service application on the CRM server in a different website (but on the same box) that allows client script calls. Now you can send soap envelopes to that service from the jscript behind your button, that app would use a different user context or impersonation and call the web service methods you are looking for.
2. You could probably create a custom entity and give all your users write access to it, then you could illicit an update call on that entity (could be on any instance of the entity) using a jscript call from behind the button. You would attach a plugin to the update message of that custom entity that used impersonation or ran in a different users context to then perform the claim action against the web service.
I hope you find this helpful.
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Tuesday, April 19, 2011 3:05 PM
- Marked as answer by darrmerc Friday, May 13, 2011 8:27 AM
Tuesday, April 19, 2011 1:20 PMModerator -
Further thinking on option 2 which you mentioned above. Is it possible to call a plugin directly from javascript? That way I would not need the additional entity to trigger the plugin.
Darren MerciecaTuesday, April 19, 2011 2:04 PM -
No it is not possible directly, that is why I proposed creating a custom entity that has one instance in it. Then you can perform an update call on that instance and just update anything. Then if you attach a plugin to the update of that custom entity, it will fire.
So you can call it using jscript, but you are doing it by triggering a platform message it is attached to, which isn't really direct, but it works.
You can call a web service also directly through jscript if the service resides on the same server and the service allows it.
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!
Tuesday, April 19, 2011 2:40 PMModerator -
I found this article
http://www.thuta.info/2010/02/impersonate-crmservice-web-service.html
can I use impersonation in this way to change the owner of the entity?
Thanks
Darren
Darren Mercieca- Proposed as answer by Jamie MileyModerator Thursday, April 21, 2011 3:39 PM
- Unproposed as answer by Jamie MileyModerator Thursday, April 21, 2011 3:40 PM
Thursday, April 21, 2011 2:52 PM -
Thanks Jamie Option 2 worked fine for me.
Darren MerciecaFriday, May 13, 2011 8:27 AM