Notifications
Announcements
No record found.
Hi All,
// example GetBitValue("telephone1");
function
GetBitValue(fieldname) {
return
Xrm.Page.data.entity.attributes.get(fieldname).getValue();
}
*This post is locked for comments
For Bit field, walkthrough this:
www.infinite-x.net/.../crm-bit-fields-creating-a-consistent-user-experience
Get and Set Bit fields using javascript refer this,
intersection3.com/.../dynamics-crm-2015-javascript-reference
Hello,
"firstly for the above in place of fieldname both the places should I use "telephone1" i.e with quotation marks or what " ---------
This is a correct code only where GetBitValue("telephone1") is calling of the method, so here you are passing telephone1 field, if you want to get another field you will be sending like this only, for example GetBitValue("address1_city")
"Ssecondly is the function "GetBitValue" valid for crm 2015 and what is meant by bit Field.."
The same function will work for CRM 2015 as well. Bit field is another field (actually "two optionset") that is used to get true or false option, so if you want get value of your bit field you need to just pass name of your bit field to this method
Make sure you are not missing any { otherwise you will get error, you could share your updated code here for inquery
Hi HIMBAP,
// JavaScript source code
GetBitValue("telephone1");
function GetBitValue(fieldname) {
var first= Xrm.Page.data.entity.attributes.get(fieldname).getValue();
alert(first):
above is the code and I have added this on on change event of phone field and am calling GetBitValue i.e first function
is it the right way..?
am getting the Error :'GetBitValue' is undefined
If you want to call then you need one more method like below, and you need to call GetValue method onchange of the field, just function name without any ()
function GetValue()
{
GetBitValue(Xrm.Page.getAttribute("telephone1"));
alert(first);
In this line:
you end with a colon, not a semicolon;
I think this is therefore failing syntax checks, so the function does not get defined.
Other than that, you want to call a function that calls this function, as mentioned above. Or pass in the execution context, or just call GetBitValue and pass the field name with quotes round it "telephone1"
I would suggest you rename this function anyway, since you are actually fetching a value which is not from a bit field, but text in this case. Your function is really just "GetValue". This might make things clearer to anyone else, or you, trying to troubleshoot in future, otherwise their first reaction is likely to be "why are you trying to get a bit value from a text field?" (even though you are not).
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2