Is there a way to add the image directly as a attachment and it would show as a tile in Service Portal?

Amrita12
Kilo Contributor

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?

find_real_file.png

1 ACCEPTED SOLUTION

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/

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

View solution in original post

7 REPLIES 7

Ahmmed Ali
Mega Sage

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.

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

Ahmmed Ali
Mega Sage

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.

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

Can you please elaborate a bit about this?

I did similar in my PDI,

find_real_file.png

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.

find_real_file.png

 

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.

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali