Solved

Change the Status and save entity from the Form

Posted on 2012-03-15
3
480 Views
Last Modified: 2012-04-11
I need to change the status of an entity and save it on click of a custom ribbon button.
If I change the status using the StatusRequest and response I first need to have the record saved. As soon as I do a Xrm.Pages.Data.entity.save the form reloads and I cannot call the state request response functions.

How does the standard CRM do it in on the mark complete ?

Any way this can be accomplised ?
0
Comment
Question by:Mayank_Bhardwaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 500 total points
ID: 37728606
Hi Mayank_Bhardwaj,

CRM has different masages to accomplish such tasks.
Try lookin into SetState message. Basically you will write JavaScript to fire a SetState method and then use Save. Remember if you are disabling the record then Save will not work after SetState.

Otherthat that you could do it this way
Keep a hidden field on the form say StateChange. While OnSave Set It To : true. OnLoad : Check if it is true or not, if yes then fire the SetState command or do whatever else you need to do. Also dont forget to change StateChange to false or relevant value after you have fired SetState request.

Regards,
Chinmay.
0
 

Author Comment

by:Mayank_Bhardwaj
ID: 37728734
Hi Chimay,
This is Mayank, your trainees Yamaha :-). Well the problem with SetState message is that the record should already be saved, cos it needs a guid of the entity as a parameter.
What I am trying to accomplish here is as follows
I have this SMS Entity. I have created a Ribbon Button called Send. On a new SMS form the user fills up all the details and when the user clicks on the send button, the sms entity should be saved with the state = Scheduled and Status Reason as Scheduled too.
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 37728774
Hi Mayank,

Of course I don't forget easy. :)

Now consider the second workaround I have mentioned. If you are not comfortable with that approach, you can always go with a Plugin.

Let me know if you see any challenges here.

Regards,
Chinmay.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

On Sep 22nd 2014 Microsoft released Update Rollup 1 for Microsoft Dynamics CRM 2013 Service Pack 1 and back in July Update Rollup 3 was released.  So we now have:   Update Rollup 1Update Rollup 2Update Rollup 3Service Pack 1Update Rollup 1 for S…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question