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

Since I am creating this form for Service Portal , I have created a Macro and with input type field and checking validation , but unable to display the image via the event . I am trying something like this : 

but the image is not getting attached

 
<div>
<input type='file' accept='image/*' onchange='openFile(event)'><br>
<img id='output'>
</div>

CSS:

img
{
height:90px;
width:90px;
}

Client Script :

var openFile = function(event) {
var input = event.target;

var reader = new FileReader();
reader.onload = function(){
var dataURL = reader.result;
var output = document.getElementById('output');
output.src = dataURL;
};
reader.readAsDataURL(input.files[0]);
};


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

Hello,

 

Hope you are doing good.

 

Please mark answer as correct to close the thread or let us know if you have query.

 

Thanks,

Ali

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

Thank you,
Ali