Emailing Document List

Hi,
I have a record list. I want the record list to be mailed using “pub.client:smtp”. When I use loop in the body(serviceIn of pub.client:smtp), i get nothing, just the text as I typed in there.
Is there a way to do this.

Also please let me know how can I format the email. Can I pass html in the body?

Thanks

Have you checked the “variable substitution” when you set the value loop in the body ie %yourrecordlist%.

Check this out.

Hi RMG,
I already checked that. I am getting the same output as I typed and not the values.
%loop%
%value RecordDetails%
%endloop%

%loop%
%value RecordDetails%
%endloop%

Looks like you are using DSP code, which will not work in regular substitution.

So just put the final variable %recordlist% in the body with variable substition ON.

HTH.

Nothing happen RMG, I tried with this one also. Same results.

I’m not sure that I understand what you want to do, but I will try.

You state that you want to “email” the results of a record set? There are not too many choices.

Take the record/document and map or pass it through:

WM6.0: pub.xml:documentToXMLString
WM4.6: pub.web.recordToDocument

In either case, the output is your record converted to a string.

Then, using pub.client:smtp, you can map the xmldata string to the body field, or you can map it to the attachments array below into the content object. Set the content type, filename appropriately.

Does this answer your question?

Ray

MAN,

Please follow the Ray steps to solve the problem.

Actually i got this idea earlier itself,but based on your requirement i have tried to convience the same,since you wants to use from %RecordDetails% variable itself.

Thanks,

Hi Ray,
I followed your steps and getting the results. But the problem is that I can’t directly map the xmldata string to the body field because I have also some other record structure to which I have to set the value to that body field of pub.client:smtp.

I used %xmldata% in the body and checked the variable substitution, but the output is “%xmldata%” and not its results.

Thanks

That’s not a problem. If you already have a field mapped to the BODY field, then here is a way to get both pieces of data in there:

Insert a map step above the call to the SMTP service or anyplace convenient. I usually call it mailBody.

When you set the mailBody field, take the first string that you are mapping currently to the body field of the SMTP service, call it myField, and using large editor (right mouse click on the setValue box and choose large and it opens up a notepad looking box) insert the field:

%myField%

%xmldata%

NOTE: I am using carriage returns so that the data is not clumped together.

Then, once this is complete, step through the service to make sure that the field contains data formatted properly. Don’t forget to map the new mailBody field to the body field of SMTP.

This is simple substitution and really easy to do. But, keep in mind that you need to comment your maps carefully or you will be hunting for this later on when you want to make a change.

HTH

Ray

H Ray,
Thanks for reply. I took the steps you told, but still one problem. Not getting xmldata in the output. Just getting the same as I typed,
%xmldata%.

I looped over Items. OutArray is xmldata. Then under that loop, used documentToXMLString and mapped those Items record to the document (input of documentToXMLString) and getting array of string as xmldata.

Thanks

IF you are seeing the data in “xmldata” variable which is the output of the documentToXMLString,then %xmldata% with variable substitution ON should work fine.

Please check the pipeline results while step thru before setting
%xmldata% substituion in the email body,whether the data exists or null.(debug the problem)

HTH.

yes, I can see the data in the xmldata string. All item data is there but when I use %xmldata% in the mailBody, it shows nothing. May be, xmldata is a String array and there must be some problem in looping

I believe it doesn’t matter with array problem or string array,as long as xmldata holds the data and with variable substitution it should appear in the body.

Ok try with documentToXMLString moving outside the loop and check the xmldata.(instead you said —under that loop, used documentToXMLString)

IF possible can you post your “xmldata” in your next message.

HTH.

Here’s a couple of tests you can do:

Map the xmldata field to something else, like stringXML. Then use the new variable. xmldata is a keyfield or term in webMethods so this could be a problem (see $xmldata).

Map the new string into the string substitution that you did before. If the first string is making it but xmldata is not, then this will probably solve the problem. Step through the flow, if you can see the new string populated properly, then it should work.

I don’t know why xmldata will not populate for you, but try to see if this will work for you.

Ray

I strongly suspect that you haven’t checked the “VariableSubstituion” (Checkbox)on the setValue box.

And use the using large editor (right mouse click on the setValue box and choose large and it opens up a notepad looking box) insert the field: %xmldata%.

Please make sure these above steps.Its fair simple.

Hi,
If I move it ouside a loop, I can get only the last item detail in the output and email.

Thanks

OK i dont want to mess up the output.
And I strongly suspect that you might have missed to check the “VariableSubstituion” (tick the Checkbox)on the setValue pop-up box.which will show the result data (%xmldata%).

One clarification, you as RMG pointed out, you have to have the variable substitution turned on. If not, you will get:

%xmldata%

in the body of the mail. Let me know what the outcome is.

Ray

RMG, I already checked that.

Here are the steps I took as u suggested:

  1. First of all, I am getting a String array as xmldata.
  2. As Ray suggested, I map it to some other string field named StringXML. By doing this, I can get only the first item detail in the email and not all.

One thing I want to mention here. xmldata is a string array. When it is used directly in the mailBody as %xmldata%, it outputs nothing. But when I map it to some string(not an array string) and then use that string in the mailBody, it outputs only first item detail.

All things are ok but I dont know why its not getting the output in the email.

One more suggestion i have is --once your final record list is build then, come out of the loop and invoke documentToXMLString (provide the documentType,so that it will use reference and build the xmldata) which should give the xmldata that contains all the (iteme details) and then set this %xmldata% in the email body with variable substitution ON.