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.

Monday, March 30, 2015

K2 SmartForms - Close all the child windows on closing parent window using JavaScript

Requirement is to close all those windows that opens from parent window on close of parent window. we are not using Modal dialog window here.


we will use java script to achieve this as below.


1. In the parent form/view place a datalabel and place the expression below as new expression:


Use the button tooltip to fire on click event in client side and open the new window, store the window open in variable and close the variable beforeunload event of the form/window.


This will make sure you are closing the window before routing .

<script type="text/javascript">$(document).ready(function() { var winVar=null;  $(window).bind("beforeunload", function(){ if(winVar != null){winVar.close();} }); $("[title='TTAction Button']").click(function() { var urlText= document.getElementsByName("dtlDocumentumURL")[0].innerHTML; winVar= window.open(urlText, '_blank', 'modal=yes,toolbar=0,location=0,menubar=0');});});</script>




If you want more details about javascript expression in DataLabel, browse below link


http://blog.velocity-it.com/2014/10/07/how-to-call-jquery-or-javascript-code-in-a-k2-smartform/comment-page-1/


In IE the window.close () does not work, if there is a pdf downloaded in popup.


So use the below code for doing the same


<script type="text/javascript">$(document).ready(function() { var winVar=null;function openPopup(link) {  var html = "<html><head><title></title>"; html += "</head><body style='margin: 0;'>"; html += "<iframe height='100%' width='100%' src='" + link +"'></iframe>";  html += "</body></html>";   win = window.open("", "_blank", "resizable=1,status=0,toolbar=0,menubar=0");    win.document.write(html);    return win;}
  window.onbeforeunload=function() { if(winVar != null){  winVar.close();} }; $("[title='TTAction Button']").click(function() { var urlText= document.getElementsByName("dtlDocumentumURL")[0].innerHTML; winVar=openPopup(urlText);}); });</script>












Friday, December 5, 2014

K2 Deployment - Custom SQL service broker





When using SQL Service broker is used with Stored Procedures you need to make sure the service instance user has the view definition permission on DB so that Stored procedures and views are loaded with proper Schema.


If not then following thing will happen.


your Stored Procedure parameters will always show as Required ( even if you have provided default value.)


Thanks

K2 Client Set Up - Error connecting to K2 Server





When installing K2 Client using set up in Windows machine after you have removed existing K2 client installation, if the Type of installation page is not showing during set up , do the following.


1. Go to Registry - start-> run-> regedit
2. HKEY_LOCAL_MACHINE - SOFTWARE - look for source code. if there is registry entry already there. Please remove and restart your machine. the Set up will ask for Type of installation page now.

Thursday, October 2, 2014

K2 Blackpearl Roles Update or Refresh (Instantly)

The trick of all this is that K2 won't actually refresh its identity cache until it needs that identity again. Setting the ExpiresOn, etc. fields as mentioned above is only half the equation. The other half is to tell K2 you need that identity object which actually triggers the refresh.

You can force the identity cache to expire for a particular role by running the following SQL query on your K2 database:

update [Identity].[Identity] set
ExpireOn = '2013-01-01',
MembersExpireOn = '2013-01-01',
ContainersExpireOn = '2013-01-01'
where FQN = 'role_name';
where role_name is the name of the role you wish to refresh. To actually trigger the role refresh, execute the Get Role Users method in the UMUser SmartObject on the role you wish to refresh.

Wednesday, November 2, 2011

New Framework K2

You can configure K2 to support .net framework 4.0 by doing the tollowing:

Modifying the "K2HostServer.config" file located in c:\program files\k2blackpearl\hostserver\bin folder.
Add the following key to the section of the K2HostServer.config file:

add key="netfxversion" value="v4.0.30319"
Restart K2HostServer.exe
a. You will be running in .NET 4 host, but will still execute .NET 3.5 code.
b. Although you can utilize .NET 4 based code constructs and references, you will not be able to use WF4 activities at this time

Ref: http://www.k2underground.com/forums/t/13211.aspx