Answered by:
diasble mark as complete

Question
-
hey i use crm 2011
on phone call i have a lookup item and i want to diasble mark as complete button when user chooses an item on the lookup field.
how can i perform it by using javascript?
thx for answerr
Software Specialist CrmWednesday, December 21, 2011 3:19 PM
Answers
-
Hii please
add a function onchangelookup and try once,
function onchangelookup()
{
//write ur conditions
var x=top.document.getElementById("phonecall|NoRelationship|Form|Mscrm.Form.phonecall.SaveAsComplete-Large");
x.style.display='none';
}
By Sanz If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by san Sanz Friday, December 23, 2011 9:38 AM
- Marked as answer by Ahmet Çankaya Friday, December 23, 2011 9:39 AM
Friday, December 23, 2011 9:38 AM
All replies
-
I don't have a fully-tested answer for you, but can nudge you in the right direction.
Read the SDK entries about modifying the ribbon behavior for stock entities, You'll end up needing to review the phone call ribbon xml in \sdk\resources\exportedribbonxml\phonecallribbon.xml
My first instinct was to create an Enable Rule with a Value Rule that tests to see if the lookup field is null and invert the result (effectively is MyField not-null) but I don't think a null or contains-data is supported here.
I think this a custom rule is more likely to meet your needs ... and in your custom JScript method you can use the ;
<
EnableRule Id="MyCustomEntity.EnableRule"
>
<
CustomRule FunctionName="MyFieldHasData" Library="$webresource:myScriptFile.js" InvertResult="true"
/>
</
EnableRule
>
and in your js file, your function would look something like this ... (not tested, typed from memory)
function MyFieldHasData(){
var myField = Xrm.Page.getAttribute("new_fieldname");
if(myField != null){
// the field is on the form
var myFieldValue = myField.getValue();
if(myFieldValue == null)
return false;
else
return true;
}
}
Timothy DariusWednesday, December 21, 2011 8:27 PM -
I don't have a fully-tested answer for you, but can nudge you in the right direction.
Read the SDK entries about modifying the ribbon behavior for stock entities, You'll end up needing to review the phone call ribbon xml in \sdk\resources\exportedribbonxml\phonecallribbon.xml
My first instinct was to create an Enable Rule with a Value Rule that tests to see if the lookup field is null and invert the result (effectively is MyField not-null) but I don't think a null or contains-data is supported here.
I think this a custom rule is more likely to meet your needs ... and in your custom JScript method you can use the ;
<
EnableRule Id="MyCustomEntity.EnableRule"
>
<
CustomRule FunctionName="MyFieldHasData" Library="$webresource:myScriptFile.js" InvertResult="true"
/>
</
EnableRule
>
and in your js file, your function would look something like this ... (not tested, typed from memory)
function MyFieldHasData(){
var myField = Xrm.Page.getAttribute("new_fieldname");
if(myField != null){
// the field is on the form
var myFieldValue = myField.getValue();
if(myFieldValue == null)
return false;
else
return true;
}
}
Timothy Darius
thx for reply but it doesnt work on me:(
Software Specialist CrmThursday, December 22, 2011 7:28 AM -
Hii please
add a function onchangelookup and try once,
function onchangelookup()
{
//write ur conditions
var x=top.document.getElementById("phonecall|NoRelationship|Form|Mscrm.Form.phonecall.SaveAsComplete-Large");
x.style.display='none';
}
By Sanz If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by san Sanz Friday, December 23, 2011 9:38 AM
- Marked as answer by Ahmet Çankaya Friday, December 23, 2011 9:39 AM
Friday, December 23, 2011 9:38 AM