Calling an image from another table
So, I am probably missing something very simple or having a complete brain fade!!
In my 'JobDockets' table, I have a button for sending out a goods dispatched email - which works great and also adds an advert attachment....
The attachment is stored in a table "SystemFile' where I keep central info/images/letters etc.
The image picked up is the first image in the first record (ie Advert1)
I also have a second image and I want to occasionally swop the image I send out. so I plan to do this by a pop up choice but for now in testing I can't get it to pick up the second image
I have tried calling the image by name
let myAtt := first(files(record(SystemFile,Advert2)));
and by offsetting the index number let myAtt := first(files(record(SystemFile,2)));
but neither of these work?
So at the moment I have to physically swop the images over
Here is my very cutdown script just showing the essential lines
which picks up the appropriate letter and then collects the image from the main
What am I missing?
let thisBody := first((select SystemFile).OrderDispatchedLetter);
let myEmail := userEmail();
let myAtt := first(files(record(SystemFile,1)));
thisBody := replace(thisBody, "{Ord Company}", text('Ordered By'));
thisBody := replace(thisBody, "{Order Name}", text('Order Name'));
etc
sendEmail({
from: myEmail,
to: 'Email+',
subject: "Your order has been dispatched by Test Co",
text: "Goods Dispatched Confirmation",
html: thisBody,
attachments: myAtt
});
end
As usual thank you in advance
Mel
9 replies
-
Mel Charles Try:
let myAtt := item(files(record(SystemFile,1)),0);
or if your attachment comes from a picture field (like your screenshot)
let myAtt := first((select SystemFile).Advert1)
Content aside
- Status Answered
-
1
Likes
- 1 yr agoLast active
- 9Replies
- 187Views
-
3
Following