How to call LaunchApp for use with Stylesheet

gonzy1981gonzy1981 Member Posts: 156
I'm trying to call LaunchApp (function in codeunit 1) to use the send to Word stylesheet option on a standard Navision command button. This function has 3 parametres, two automation (Microsoft XML->v6.0 DOMDocument60) and GUID. I'm doing this (i suppose that this code is ok or there is a error in it?)

IF ISCLEAR(Automation1) THEN
CREATE(Automation1);
IF ISCLEAR(Automation2) THEN
CREATE(Automation2);

StyleSheetId := '{C0E9AC0C-17AA-497A-AA13-3450BA82759D}';
CODEUNIT1.LaunchApp(Automation1,StyleSheetID,Automation2);

But there is a error in the codeunit 682 in the function GetAtributeValue.

Do you know something about it??

Comments

  • prabhupdeshprabhupdesh Member Posts: 49
    You are getting error because automation1 and automation2 variables are empty.

    In navision 5, this functionality works fine because system automatically creates a xml document before calling this function and assign this xml document to these variable.
    The xml variables automation1 and automation2 must represent a xml document.

    If you are trying to simulate this functionality of navision 5 , then i can only say BEST OF LUCK.....this is just the first obstacle in your path....
  • gonzy1981gonzy1981 Member Posts: 156
    Ok i understood it, i'm going to try it in the classic client.
  • gonzy1981gonzy1981 Member Posts: 156
    I'm doing this:

    Rec.FINDFIRST;
    REPEAT
    XMLFile.OPEN(MyPath);
    XMLFile.CREATEINSTREAM(XMLInStr);

    //Automation1 ->Automation->'Microsoft XML, v6.0'.DOMDocument60
    //Automation2 ->Automation->'Microsoft XML, v6.0'.DOMDocument60
    CREATE(Automation1);
    Automation5.load(XMLInStr);
    XMLFile.CLOSE;

    IF ISCLEAR(Automation2) THEN
    CREATE(Automation2);

    RecStyleSheet.SETRANGE("Object ID",21);
    RecStyleSheet.FINDFIRST;

    CODEUN1.LaunchApp(Automation1,RecStyleSheet."Style Sheet ID",Automation2);
    UNTIL Rec.NEXT = 0;


    But i've a error in this place:

    Codeunit682
    GetAttributeValue(DataXML,XPath,AttributeName)
    Node := DataXML.selectSingleNode(XPath);
    Attributes := Node.attributes;
    AttributeNode := Attributes.getNamedItem(AttributeName);
    EXIT(AttributeNode.text);

    Do you know what is the error??
  • Steve.DesmedtSteve.Desmedt Member Posts: 13
    Dear,

    Have you already found a solution for this ?
    I have exactely the same issue.

    Kind regards
Sign In or Register to comment.