Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Change the Status and save entity from the Form

Posted on 2012-03-15
3
Medium Priority
?
497 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 1500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

721 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