This is in continuation to my previous post-K2 cloud REST service broker integration with Muhimbi Converter Service Online. In this blog, let’s create the most significant features of the K2 platform “SmartObject”.
So what is SmartObject?
A SmartObject is actually nothing more than a set of instructions that maps various properties and methods for a logical object to equivalent properties and methods in a data source, using a specific broker (That’s sound too Complicated, Don’t Worry). This blog will help you create SmartObject method which will help convert documents to PDF file and trust me, it’s not that difficult as long as these instructions are followed very carefully.
Before we begin:
- Make sure the following prerequisites are in place.
- Muhimbi Converter Service Online Integration facilities have been configured.
- Appropriate privileges to K2 Management portal and K2 Designer.
- The individual should have intermediate knowledge on how to use K2 designer and create SmartObject.
STEP 1: Open K2 Designer and Click on CREATE “SmartObject”.
STEP 2: Click on the General tab and then select the Advanced SmartObject option and Click on Create.
STEP 3: Click on Methods Tab and Click on Add.
STEP 4: On the Properties and Method with the ‘SELECT A SERVICEOBJECT METHOD’, selected click on ‘Converter Service Online(Production) > Convert data > Serialize and then click on NEXT.
STEP 5: On the DETAILS screen, leave all values as default and Click on NEXT.
STEP 6: With INPUTS & OUTPUTS selected, click on ‘Create ALL‘. But Don’t click on NEXT.
- On the same(‘INPUT & OUPUTS’) screen.
- Select the Serialized Item(String) INPUT PROPERTY and set the “SmartObject property” to “Source_File_Content”.
- Click on OK and then NEXT.
STEP 8: On the SERVICEOBJECT METHODS screen, click on FINISH.
STEP 9: The ‘Convert data’ request method must look like the screenshot below.
Now that we have configured the “Convert Operation REQUEST”, let's Configure the Operation Response.
Step 10: Double Click on the Serialize Method, the following screen appears.
Step 11: On the SERVICEOBJECT METHOD tab with “Convert data: Serialize” Method selected, click on Add.
- When you click Add button the following screen below opens.
- On the ServiceObject method click on the ellipses (…).
STEP 13: Select the ‘Convert‘ method under ‘Operation response‘ for Muhimbi Converter Service Online(Production) > Object Type and Click OK.
- With the ServiceObject method > ‘Converter Service Online(Production) Operation response.Convert‘ selected click on ‘Create All’.
- But Don’t Click on NEXT.
- On the same screen (‘INPUT & OUPUTS’) selected.
- Select the Input_data(Convert_data) property and set the “SmartObject property” to “Source_File_Content” click on OK.
- On the Add ServiceObject method binding screen again on OK
- On the Edit Method screen click on FINISH.
- Your final SmartObject should look like, the screenshot below.
- Click on ‘Save and FINISH’.
Congrats you have successfully created your first “Convert to PDF(Muhimbi)” SmartObject.
Now it’s time to TEST our SmartObject ?.
- Navigate to K2 Management portal > Categories > REST > ‘Convert to PDF(Muhimbi)’.
- Scroll down the page and select the ‘Serialize’ method and Click on ‘Execute’.
Fill in the Mandatory parameters and click on ‘Execute‘.
- Source_file_name: clavin.txt
- Source_file_content (Base64 String): TXVoaW1iaSByb2Nrcw==
- Output_fomat: PDF
Hurrah ‘Success’ ?….
Now that we have configured our first Smart-Object and Tested it, in the next blog we will create our First Workflow using the SmartObject.
Subscribe to my blog for the latest updates about SharePoint Online, Microsoft Flow, Power Apps and document conversion and manipulation.