Asked by:
how to get current stage name through javascript in crm 2013

Question
-
Hi,
I want to get current stage name through javascript in crm 2013. I got stageid through this code
Xrm.Page.getAttribute("stageid").getValue();
- Changed type HIMBAPModerator Tuesday, February 3, 2015 2:52 PM
Tuesday, February 3, 2015 8:16 AM
All replies
-
Hello
CRM 2011 (if there is an attribute stageid :p):
As I don't know what kind of attribute your stageid on your form is:
If your stageid attribute is an option set:
http://www.mscrmconsultant.com/2012/08/get-optionset-attribute-value-and-text.html
If your stageid is a lookup attribute:
http://crmdm.blogspot.be/2011/03/how-to-retrieve-lookup-text-value-id.html
If your stage id is a text field attribute (look for retrieve method based on id):
https://xrmservicetoolkit.codeplex.com/wikipage?title=Rest%20Functions
CRM 2013/2015:
Entities with stages have an attribute 'stepname', returns a string
Xrm.Page.getAttribute('stepname').getValue();
- Edited by Jochen- Tuesday, February 3, 2015 4:03 PM Didn't notice it was CRM 2013+
Tuesday, February 3, 2015 12:20 PM -
Hi,
Did u try
Xrm.Page.getAttribute("stageid").getText();
Regards, Rekha.J
Tuesday, February 3, 2015 12:31 PM -
You can use
var stageName=Xrm.Page.data.process.getActiveStage().getName();
Microsoft Dynamics CRM Training|Our Blog | Follow US | Our Facebook Page | Microsoft Dynamics CRM 2011 Application Design
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.- Proposed as answer by HIMBAPModerator Tuesday, February 3, 2015 2:52 PM
Tuesday, February 3, 2015 2:51 PMModerator -
Hi Try this: var stage = Xrm.Page.getAttribute("stageid").getValue(); Var stageName = stage[0].name;Wednesday, February 4, 2015 8:40 PM
-
it works only for 2015
Faust
Thursday, February 12, 2015 9:27 PM -
for CRM 2013, it is impossible to do it from JavaScript API on form. for 2015 Xrm.Page.data.process.getActiveStage().getName()
Sure you can retrieve stage by Id by Fetch Xml
Faust
- Edited by Roman VVa Thursday, February 12, 2015 9:29 PM
Thursday, February 12, 2015 9:28 PM -
Dear Amir,
Pipeline Phase (Step name ) is not present in page, so you are not getting the stage name , please add pipeline phase field and hide it and then use below script:
Xrm.Page.getAttribute("stepname").getValue();
Friday, February 13, 2015 6:37 AM