SmartObjectServiceFunctions – Authentication Failed: The target principal name is incorrect

[Origin] http://community.k2.com/t5/K2-blackpearl/SmartObjectServiceFunctions-Authentication-Failed-The-target/ta-p/87586

Symptoms 

SmartObjectServiceFunctions – Authentication Failed: The target principal name is incorrect

Diagnoses
When you receive an error when trying to Create CRM Entity Item within K2 Studio.

As a result you are unable to connect to the CRM Server despite being able to use the Smart Object Tester to create records using the relevant Smart Object.

Resolution

You can resolve this issue by refreshing the ‘SmartobjectServicefuction’ service instance and service object. After this you should be able to drag in the event to any activity within studio.

Note: use the server tool ‘SmartObjects Service Tester’ to refresh it.

How to simulate for-each loop with K2 workflow?

https://startrule.wordpress.com/2014/07/10/create-a-loop-using-workflow-activities/

CREATE A LOOP USING WORKFLOW ACTIVITIES

Originally posted on the K2 Underground on Fri., Nov. 29, 2013 You’re developing in K2 Studio and need to iterate over some data. This document will show you how to create a loop using workflow activities and events.  Create-a-Loop-Using-Workflow-Activities

K2 Blackpearl: Adding URL links to your email message body

http://blogs.claritycon.com/blog/2014/10/k2-blackpearl-adding-url-links-email-message-body/

Have you run into a scenario where you have to include a URL in the email and when you use <a href> tag in the email body, the generated email link has weird characters (<span> etc) essentially making the URL link invalid. Here are a couple of ways in order to get it to work:

Assume the URL link to use is http://www.google.com?MyId={Variable} where {Variable} is a K2 defined value or data field etc.

Saving the URL in a data variable and passing it into the email body

Create a data event and set the source as:<a href=” http://www.google.com?MyId={Variable}”?Google</a>

If you do not include the a href tags, it will NOT work!

Using the HyperLink inline function

In the email body, you can use the HyperLink function to create URL which will have a href tags automatically built in.

Hyperlink function

The one thing that you must be cautious of is when building the URL as it is in an expression format. So you have to “build” the string and treat any field variables as input variable and append it the expression. For example, the expression for the above URL would be:

http://www.google.com?MyId=” & {Variable}

Attempts that won’t work

Prior to coming up with the above solutions, I had to try various permutations and below is a list of things that will not work. Hopefully, you will not make the same mistakes:

  1. Adding the <a href=” http://www.google.com?MyId={Variable}”?Google</a> directly into the message body:
    MessageBody
  2.  Creating a data event but the source is missing the <a href> tag
  3. Using the URL decode: This will return the URL but if you directly reference the URL into the message body, you have the same issue.

Happy linking!

Using smartforms rule “Get Confirmation from user”

http://community.k2.com/t5/K2-blackpearl/Using-smartforms-rule-quot-Get-Confirmation-from-user-quot/td-p/64358/page/3

There is a way to configure rules so that different execution blocks fire depending on whether the user clicked “OK” or “Cancel”. See the screenshot below.

The key is to use a “advanced condition” that always evaluates to True (e.g. 1 = 1). That allows you to add an “else” statement and you can put Actions into the Else block. With this configuration. if the user clicks “OK”, all the actions that follow the “get confirmation action” will fire. If the user clicks “Cancel”, all the actions in the “else” block will fire.

Note: this approach also works with the “Show a Message to the user” action as well if you change the message box to be a “Confirmation” type.