Hi,
Dumping the field content to a text field has the major drawback that it will
be parsed by the command/shell interpreter. This might corrupt the data, and
there is typically also a maximum size for the data that can be sent this way.
The filter plugin will ensure that everything stays unchanged, and then get
attached to the server.
Other than the filter plugin name, this is what the arfilterapiskl.c could
look like. I have not tested it though...
ARPLUGIN_EXPORT void ARFilterApiCall(
void *object, /* IN; plug-in instance to delete*/
ARValueList *inValues, /* IN; arguments passed via workflow */
ARValueList *outValues, /* OUT; return values back to workflow */
ARStatusList *status /* OUT; status of the operation */
)
{
unsigned char *data;
char *filename;
if(status) /* make to clear the return message list */
{
memset(status, '\0', sizeof(ARStatusList));
}
if(
inValues &&
inValues->numItems == 2 &&
inValues->valueList[0].dataType == AR_DATA_TYPE_CHAR &&
inValues->valueList[1].dataType == AR_DATA_TYPE_CHAR &&
)
{
data = valueList[0].u.charVal;
filename = valueList[1].u.charVal;
if(outValues) /* store data in an ARAttachStruct */
{
outValues->numItems = 1;
outValues->valueList = (ARValueStruct *) calloc(1, sizeof(ARValueStruct));
outValues->valueList[0].dataType = AR_DATA_TYPE_ATTACH;
outValues->valueList[0].u.attachVal = (ARAttachStruct *) calloc(1,
sizeof(ARAttachStruct));
outValues->valueLsit[0].u.attachVal->name = strdup(filename);
outValues->valueLsit[0].u.attachVal->loc.locType = AR_LOC_BUFFER;
outValues->valueLsit[0].u.attachVal->loc.u.buf.bufSize = strlen(data);
outValues->valueLsit[0].u.attachVal->loc.u.buf.buffer = strdup(data);
}
}
else if(status) /* return error if arguments was not supplied */
{
status->numItems = 1;
status->statusList = (ARStatusStruct *) calloc(1, sizeof(ARStatusList));
status->statusList[0].messageType = AR_RETURN_ERROR;
status->statusList[0].messageNum = 1234567;
status->statusList[0].messageText = strdup("Wrong arguments supplied to
filter plugin, send content text first followed by the desired file
name");
status->appendedText = NULL;
}
return;
}
Best Regards - Misi, RRR AB, http://www.rrr.se (ARSList MVP 2011)
Ask the Remedy Licensing Experts (Best R.O.I. Award at WWRUG10/11/12/13):
* RRR|License - Not enough Remedy licenses? Save money by optimizing.
* RRR|Log - Performance issues or elusive bugs? Analyze your Remedy logs.
Find these products, and many free tools and utilities, at http://rrr.se.
> I did something similar with running a processcmd of type $fieldname$ >
> filename
> Then do an addatachment function (not looking at the exact function name) of
> the file. I even did multiple files into a directory (ie the attachments in
> the worklog), zipped them up and imported the zip file which was later used as
> an attachment to the approval email - then the folks just replied to the email
> with 'Approve' or 'Reject' (plus some variations of those words).
>
> -----Original Message-----
> From: Action Request System discussion list(ARSList)
> [mailto:[email protected]] On Behalf Of Misi Mladoniczky
> Sent: Thursday, June 25, 2015 11:24 AM
> To: [email protected]
> Subject: Re: Field HTML Contents to Text Attachment
>
> Hi,
>
> I would build a Filter Plugin that takes for example two arguments:
> Input Text: $TheTextFieldWithHtml$
> Input Filename: $1$+".html"
> Output Attachment: ...
>
> Coding that would just be a few lines of code in either C or Java.
>
> Best Regards - Misi, RRR AB, http://www.rrr.se (ARSList MVP 2011)
>
> Ask the Remedy Licensing Experts (Best R.O.I. Award at WWRUG10/11/12/13):
> * RRR|License - Not enough Remedy licenses? Save money by optimizing.
> * RRR|Log - Performance issues or elusive bugs? Analyze your Remedy logs.
> Find these products, and many free tools and utilities, at http://rrr.se.
>
>> Good Morning,
>>
>> I am looking to see if anyone has done something like this before and
>> what method they may have used.
>>
>> I have a Remedy character field that contains a large amount of HTML text.
>> I want to create a text file that contains the contents of that
>> character field, name it "RequestID.html", and then place it into a
>> Remedy attachment field. We have tried a few things but neither is
>> clean or has been without
>> issues:
>>
>> - Build the file using DOS command within a filter Run Process (ECHO
>> to a
>> file)
>> - Build the file using a filter Notify mechanism of Other (then rename
>> the resulting .ARN notification file and attach it)
>>
>> Any other ideas or suggestions on how we might accomplish this is
>> appreciated.
>>
>> Best regards,
>> Jeff
>>
>> ______________________________________________________________________
>> _________ UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
>> "Where the Answers Are, and have been for 20 years"
>>
>
> _______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org "Where the Answers
> Are, and have been for 20 years"
>
> _______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
> "Where the Answers Are, and have been for 20 years"
>
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
"Where the Answers Are, and have been for 20 years"