Skip to main content

I have a project that uses a Smart Object to create a PDF through Adlib, but I need it to go from one Activity into another Create PDF activity. The first creates a PDF of one of the Infopath views then I need to change the views in the second create PDF. The problem is that anything I do to change the Print View returned to Adlib will not wok since the Infopath form is not getting opened between activities. I tried to do the following in a Server Code Event, but it errors anyone come across a solution to this before?


//Get the XML Field string
string xml = (string)K2.ProcessInstance.DataFields["UpdatedXML"].Value;

//Load up the XML
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);

//Create a name space manager for InfoPath
XmlNamespaceManager nsMgr = new XmlNamespaceManager(doc.NameTable);
nsMgr.AddNamespace("my", doc.DocumentElement.GetNamespaceOfPrefix("my"));

//Now set some values
doc.SelectSingleNode("//my:Form0419/my:PrintSelect", nsMgr).InnerText = "Print View 2";

//Now set the value back into the XML Field
K2.ProcessInstance.XmlFields["XXX"].Value = doc.OuterXml;

Hi,


If you are using this InfoPath form as part of your K2 process then K2 regulates which view opens by looking at the DocumentView node in the _K2 group. In your activity you can use a K2 Data Event and update the value of the DocumentView node before you send it to be converted. Type the name of the view into the Source field and drag the DocumentView field into the Destination field of the wizard.


This should sort you out without any custom code.


Let us know if this worked.


Reply