writeattach.exe

 11 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
Jeff Pratte
Basic Member
Posts: 13
Basic Member

    We can't get our upload script working.

    We copied an upload a consultant wrote for us and tweaked it a bit. However, it looks like the writeattach.exe is throwing an error – “Create attachment failed with the following error: Invalid value for User Defined Type: _AUDT=(I).”

    With the web research I have done, it seems like AUDT=I is valid!? We have tried "I", "A" and nothing. But we always get the same error message.

    Attached is the program we have created.

    Thanks for your help, Jeff
    Attachments
    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      Are you attaching a URL? You have ATYPE=U and it would be ATYPE=C for comment.
      I thought it would be ATYPE=A for attachment (which is what a URL usually is).
      AUDT stands for the type of comment (not sure of the correct ones for CBPAYMENT).
      David Williams
      John Henley
      Posts: 3353
        Based on your code, it looks like you are trying to upload a URL (&_ATYP=U&_AUDT=I&_USCH=http).
        That is not supported by that particular table/attachment type. The best you can do is to 1) create a new attachment type (which would be a modification), or 2) attach the URL as a text comment, which would not be "linkable" from Portal.
        Try:
        &_ATYP=C&_AUDT=A
        Thanks for using the LawsonGuru.com forums!
        John
        Jeff Pratte
        Basic Member
        Posts: 13
        Basic Member
          We are trying to do the same thing for CB that we did for GL (i.e. a custom script to allow an "upload" button to upload a document and save it as an URL for the current record.

          This is what worked for GL: var t = "http://" + serverBBB + "/cgi-lawson/writeattach.exe?_OUT=XML&"
          t += "_PDL="
          t += prodline
          t += "&_FN=GLCONTROL&_IN=GLCSET1"
          t += "&K1="
          t += m_Company
          t += "&K2="
          t += m_FiscalYear
          t += "&K3="
          t += m_AcctPeriod
          t += "&K4="
          t += m_System
          t += "&K5="
          t += m_JeType
          t += "&K6="
          t += m_ControlGroup
          t += "&K7="
          t += m_JeSequence
          t += "&_ATYP=U&_AUDT=A&_USCH=http&_DATA=TRUE&_OPM=M&_ECODE=FALSE&_ATTR=TRUE&_AOBJ=TRUE"
          t += "&_ANAM="
          t += escape(m_Title)
          //t += escape(document.getElementById('F2').value)
          t += "&_ATXT="
          t += escape(strAttachURL)

          Will that not work on the CB side???

          Where do you find valid values for all of thee different variables?
          Terry P
          Veteran Member
          Posts: 234
          Veteran Member
            I've done something similar for several attachments. What I found useful was to run portal in debug mode. Then go and actually do an attachment. Then look at the resulting code in the debug window to to what parameters, etc are being passed.
            Jeff Pratte
            Basic Member
            Posts: 13
            Basic Member
              @Terry,

              When I turn debug on and try to upload, I get an error message back from writeattach.exe, but nothing shows up in the debug window.

              Does anyone know if you can even upload items for CB???

              Thanks, Jeff
              Terry P
              Veteran Member
              Posts: 234
              Veteran Member
                What form are you trying to do this on?
                John Henley
                Posts: 3353
                  The short answer is that you can’t attached a URL for CBPAYMENT as you can for GLCONTROL, because the attachment type for GLCONTROL (URL) is different than for CBPAYMENT (comment).





                  As for how you figure it out, I have attached some documentation (I think this was from Lawson but not sure) on the syntax, as well as a white paper I wrote on Comments/Attachments.

                  Personally, I have to dive into the .or files myself and just try a lot of trial and error.
                  Attachments
                  Thanks for using the LawsonGuru.com forums!
                  John
                  Jeff Pratte
                  Basic Member
                  Posts: 13
                  Basic Member
                    @John,

                    Thanks for your reply - however I can't see the pngs you embedded.

                    Jeff
                    Jeff Pratte
                    Basic Member
                    Posts: 13
                    Basic Member
                      @Terry, CB55.1
                      John Henley
                      Posts: 3353
                        Posted By Jeff Pratte on 10/19/2011 08:24 AM
                        @John,

                        Thanks for your reply - however I can't see the pngs you embedded.

                        Jeff

                        Jeff, sorry about that.  Images now shown.
                        Thanks for using the LawsonGuru.com forums!
                        John
                        Terry P
                        Veteran Member
                        Posts: 234
                        Veteran Member
                          As John pointed out, the only attachment type for CB55.1 are comments, not URL. I'm sure you can figure out how to write a comment out without too much problem. You might be able to get creative and put in the comment the URL of the attachment to make it work similar, but I've never tested doing something like that. The problem is how to make it a hot link and not just text.

                          Sorry, couldn't help much on this one.