Wednesday, June 17, 2015

Communication from K2 Smart form hosted in iframe from parent



Please find that when K2 smart form is hosted inside an iframe say for eg: in CRM, you want to trigger K2 event from CRM button click, you can achieve this as below:

in CRM using javascript to call

iframe.contentWindow.postMessage("hi","*"); (if "*" doesn't work use server url +port like http://10.2.3.4:82)


Then use data label in view / form and put below in expression to listen to the event.


<script type="text/javascript">$(document).ready( function(){ var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";var eventer = window[eventMethod];var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";   eventer(messageEvent, function (e) { if (e.data=="Validate") { $("[title='btnValidateToolTip']").trigger("click"); var txtValidation = $("[title='dtlValidationToolTip']").text();  e.source.postMessage(txtValidation, "*"); } else {   $("[title='btnSaveToolTip']").trigger("click"); }  }, true); });</script>

End

Monday, June 1, 2015

Workspace error




When I go to the web occurs to me this error. 
User is the domain admin.  Created in IIS  full domain name, but still does not work.


Initialization failed: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: indexAn error has occurred.
Please contact your administrator.
Error:
Initialization failed before PreInit: Thread was being aborted.
Possible causes
- using anonymous logon in IIS while Windows security is specified in Workspace configuration
- current logged on user can not be verified against the Active Directory Membership provider
- please review log files for more information


Answers:

Following could be the condition

1. check if other users are able to access

if Yes then check for duplicate in workspace.userprofile table using below query
"
SELECT  userid
  FROM [K2].[Workspace].[UserProfile]

 group by userd having count(*) > 1
"

duplicate then remove one of them from the userprofile table and Bingo!!!!

2. Else
Open the workspace web.config file, search for Ldap you shoud see this LDAP://[domain]). At the end of the .com of the domain add :389 The correct string should look like this “LDAP://[domain]:389” Do an IIS reset and workspace should work.