Silverlight + CRM 2011 - Lookup to SystemUser, Enabling "Remove Value" button.
-
2012년 4월 16일 월요일 오전 9:49
Hey guys,
So, I have the below situation.
I have a Silverlight application/web resource in a CRM 2011 form, it looks like the below image:
When clicking on the button (Opens up a lookup window for SystemUser) next to the name field (With a user populated). I would like to enable the “Remove Value” button on the lookup window. (Below image)
Any ideas on how I can go about accomplishing this?
Regards
_Hopeful.
모든 응답
-
2012년 4월 16일 월요일 오후 12:48
You need to pass an items array in the argument object (oArgs in the following code sample) when you call showModalDialog. Then, the "Remove Value" button will be enabled in the lookup window and you can check the return value to check which button the user clicked.
var oArgs = new Object(); oArgs.items = [""]; var answer = window.showModalDialog(<Lookup URL>, oArgs, <Modal Dialog Properties>); if (answer == null) // The user clicked the Cancel Button else if (answer.items.length == 0) // The user clicked the Remove Button else // Get the answer.items[0].id and answer.items[0].name and process
-
2012년 4월 16일 월요일 오후 1:17
Hi Linn,
This is in a Silverlight Application/Web Resource. The below is how I get the lookup window displayed:
string lookUp = serverUrl + "/_controls/lookup/lookupinfo.aspx?..."; dynamic Returned = HtmlPage.Window.Invoke("showModalDialog", lookUp, "dialogWidth:600px;dialogHeight:600px"); -
2012년 4월 16일 월요일 오후 1:29
Hi Linn,
By doing the below:
var dArgs = new Object(); dArgs.items = "qwerty";
I get the below error for dArgs.items
'object' does not contain a definition for 'items' and no extension method 'items' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
-
2012년 4월 16일 월요일 오후 2:12
Ohhh... I forgot that you're implementing Silverlight solution and I just gave you the JavaScript Code.
I don't know much about Silverlight development but can you pls try the following code?
System.Windows.Browser.ScriptObject dArgs = new System.Windows.Browser.ScriptObject(); dArgs.SetProperty("items", new string[] { "" }); string lookUp = serverUrl + "/_controls/lookup/lookupinfo.aspx?..."; dynamic Returned = HtmlPage.Window.Invoke("showModalDialog", lookUp, dArgs, "dialogWidth:600px;dialogHeight:600px");
- 편집됨 Linn Zaw Win 2012년 4월 16일 월요일 오후 2:13
- 답변으로 표시됨 _Hopeful 2012년 5월 6일 일요일 오후 1:43
-
2012년 4월 25일 수요일 오전 3:03
Hi,
Is that working now? Pls post your solution if you have done things other than my suggestions.
Please "Mark As Answer" if my post helped you solving the problem. This will help others with similar problem identify the answer and also close this thread as resolved.
Thanks
Linn -
2012년 9월 25일 화요일 오후 5:25
Hi Linn,
Using the code above I get the following error:
"The type 'System.Windows.Browser.ScriptObject' has no constructors defined.
This happens on this line:
System.Windows.Browser.ScriptObject dArgs = new System.Windows.Browser.ScriptObject();
Any ideas on this please?
Also I need to be able to detect when 'Remove Value' is clicked as opposed to the user clicking 'Cancel'. When the user clicks 'Cancel', Null will be returned. Does anyone have any idea of how to detect that 'Remove Value' has been clicked instead of 'Cancel'? Can dArgs be examined in some way after the modal dialog closes?
Thanks
Daniel
-
2013년 1월 28일 월요일 오전 3:36
Take a look at my project on codeplex. It is a silverlight lookup for crm 2011
http://silvercrmlookup.codeplex.com
ishan
- 편집됨 Ishan Chinthaka 2013년 1월 28일 월요일 오전 3:39