- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2020 03:54 AM
Is there a way to directly upload an image as an attachment in a order guide/record producer and have it reflect there immediately like the profile page?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2020 10:15 PM
You can try another approach as below.
Keep HTML code as my previous comment, in client controller you can call server and in server side, you can query sys_attachment table to check the type of the attachment. then either you can clear attachment variable or show image based on validation result.
https://serviceportal.io/communicating-between-the-client-script-and-the-server-script-of-a-widget/
Thank you,
Ali

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2020 04:00 AM
You can try adding a widget in form with macro type variable on record producer.
in macro you can add record watch for attachments/or if there is any OOTB event triggered when an attachment is added. then you can show that image using img tag in widget HTML.
It is bit complicated, but can be done.
Thank you,
Ali

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2020 04:02 AM
or if you are on Paris release, you can add Profile picture variable of type as attachment in form. then on change of that variable, you can show that attachment in custom widget (added as macro variable) html using img tag.
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2020 08:17 PM
Can you please elaborate a bit about this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2020 08:33 PM
I did similar in my PDI,
above is attachment variable on record producer.
When we upload any picture to above field, it will show that image just below the field as below.
Created one widget with below HTML and client controller:
HTML:
<div>
<!-- your widget template -->
<img src="{{imgSRC}}" ng-if="imgSRC"/>
</div>
Client controller:
api.controller=function($scope,$rootScope) {
/* widget controller */
var c = this;
c.messageToShow = "PLease upload an image!";
$rootScope.$on("field.change", function(evt, parms) {
if(parms.field.name == "profile_picture"){
if($scope.page.g_form.getValue("profile_picture")){
$scope.imgSRC = "/" + parms.newValue + ".iix";
}else{
$scope.imgSRC = null;
}
}
});
};
Create a macro type variable and add this widget in that macro variable.
Here you need to enhance code with validation on attachment to be an image and also you can set image css in HTML so that image shows in size as required.
Hope this helps.
Thank you,
Ali