Hi,
How it can be found out in which view / form a smartobject is used ?
I have a smartobject "XYZ". Need to find in which view / form it is used ?
Appreciate a quick response
Thanks and Regards,
Satya
Hi,
How it can be found out in which view / form a smartobject is used ?
I have a smartobject "XYZ". Need to find in which view / form it is used ?
Appreciate a quick response
Thanks and Regards,
Satya
One thing that you can do is use the package and deployment P&D tool to return dependencies. Create a package and select only this SmartObject; this should return items that references this SmartObject.
Hi tin,
Thanks for you reply. I was wondering if anything else apart from this exists.
Thanks and Regards,
Satya
Package and Deployment Tool does not list out the Forms and Views where a partcular SmartObject is used.
It does the reverse where in it lists out the dependencies of a Form / View .
How can I find out in which Form(s) and View(s) a Smartobject is used ?
Appreciate a response on this.
Thanks and Regards,
Satya
You can try using the following assemblies/apis:
using SourceCode.Forms.Management;
using SourceCode.SmartObjects.Client;
using SourceCode.Hosting.Client;
Found at "C:Program Files(x86)K2 blackpearlBin"
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder connectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
connectionString.Authenticate = true;
connectionString.Host = "localhost";
connectionString.Integrated = true;
connectionString.IsPrimaryLogin = true;
connectionString.Port = 5555;
FormsManager fm = new FormsManager();
fm.CreateConnection();
fm.Connection.Open(connectionString.ToString());
SmartObjectClientServer smoserver = new SmartObjectClientServer();
smoserver.CreateConnection();
smoserver.Connection.Open(connectionString.ToString());
Console.WriteLine("Enter SmartObject SystemName (Not DisplayName):");
String smoSystemName = Console.ReadLine();
SmartObject smo = smoserver.GetSmartObject(smoSystemName);
Guid smoGuid = smo.Guid;
Console.WriteLine("SMO Guid: " + smoGuid);
//searches against Form XML for SmartObject Guid
Console.WriteLine("Found In: ");
FormExplorer fe2 = fm.GetForms();
foreach (FormInfo fi in fe2.Forms)
{
String formDisplayName = fi.DisplayName;
String formSystemName = fi.Name;
Guid formGuid = fi.Guid;
String formDef = fm.GetFormDefinition(formGuid);
if (fi.IsSystem == false && formDef != null)
{
if (formDef.Contains(smoGuid.ToString()))
{
Console.WriteLine("FormDisplayName: " + formDisplayName + " SystemName: " + formSystemName);
}
}
}
//searches against View XML for SmartObject Guid
ViewExplorer ve2 = fm.GetViews();
foreach (ViewInfo vi in ve2.Views)
{
String viewDisplayName = vi.DisplayName;
String viewSystemName = vi.Name;
Guid viewGuid = vi.Guid;
String viewDef = fm.GetViewDefinition(viewGuid);
if (vi.IsSystem == false && viewDef != null)
{
if (viewDef.Contains(smoGuid.ToString()))
{
Console.WriteLine("ViewDisplayName: " + viewDisplayName + " SystemName: " + viewSystemName);
}
}
}
fm.Connection.Close();
fm.Connection.Dispose();
smoserver.Connection.Close();
smoserver.Connection.Dispose();
Console.ReadLine();
Warning: not really a coder, but the applicable objects and methods are there
Enter SmartObject SystemName (Not DisplayName):
TestSMO_2
SMO Guid: f83e2308-2f87-4453-9896-1e5e8db13012
Found In:
FormDisplayName: FormNoIntegration SystemName: FormNoIntegration
ViewDisplayName: TestSMO Editable List SystemName: TestSMO Editable List
ViewDisplayName: NoIntegration SystemName: NoIntegration
ViewDisplayName: TestSMO Item SystemName: TestSMO Item
TestResult
You can use the query below to find which view/s smartobject XYZ is being used:
SELECT * FROM [K2].[Form].[View]
WHERE ID IN (SELECT ViewID FROM [K2].[Form].[ViewSource]
WHERE SourceDisplayName = 'XYZ')
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.