Print View - images not working in Modern UI

Print View - images not working in Modern UI

philipfrench
Collaborator Collaborator
669 Views
5 Replies
Message 1 of 6

Print View - images not working in Modern UI

philipfrench
Collaborator
Collaborator

This example below used to work in Classic and Modern.

However, now it is not working in Modern.

 

What is the correct / official way to refer to an image field to render in a Print View?

 

The issue seems to be that Modern uses a different base url to classic... COMBINED WITH... the Print View source editor is removing any initial "/" when I save.

 

The effect is that I want to save a source url like this:

src="/servlets/ImageServlet/?imageid=${item.itemDetails.sections["Advanced Print View"].fields.CUSTOMER_LOGO_FILE_ID.value}

But the editor is stripping (removing) the initial "/". So "/servlets" becomes "servlets".

 

In classic this is not a problem, because the Print View is launched in not-relative way.

In Modern, it does not work, because the links seem to be relative to a deeper URL.

 

Result - I cannot enter a URL that downloads either /servlets/ImageServlet, or /api/v3/xxx or /api/v2/xxx, because the leading "/" is removed by the APV editor.

 

Even if I used the "insert artefact" option, to generate the table, this gives me a suggested link eg:

${item.itemDetails.sections["Image Details"].fields.IMAGE_CLOSEOUT.value}

Well, that just gives me the integer number of the field, certainly not a picture.

 

Does anyone know how to get image links working in Modern? Thanks.

 

This is currently blocking migration to Modern UI.

 

 

apv_issue.jpg

Accepted solutions (1)
670 Views
5 Replies
Replies (5)
Message 2 of 6

catot
Advocate
Advocate

Phil,

 

I got this working on our tenant:

<!--<img src="/servlets/ImageServlet/?imageid=${item.itemDetails.sections[&quot;Diagram Test&quot;].fields.VERTICAL_SECTION_1_IMAGE.value}" alt="" Width ="100"/> -->

 

I don't have any explanation why that works, but I remember I struggled with this a while back. Hope that helps.

0 Likes
Message 3 of 6

philipfrench
Collaborator
Collaborator

Thanks Cato

the problem is that when I enter this text, 

/servlets/

gets changed to 

servlets/

i.e. the first "/" is removed when I save it. This seems to be some "security" thing.

The problem then, is that when run without the "/" in Modern it does not work.

 

Do you have this example working in Modern?

 

I think it may work, but if you edit-save in the APV definition, it will change "/servlets" to "servlet".

 

If you have pictures working in Modern, I would be very interested to do a screen share and see how it is working for you.

 

thanks

phil

0 Likes
Message 4 of 6

catot
Advocate
Advocate

I tried copying my source code over to a new APV, and for me that works the same as before. Also editing and saving on that new APV again does not alter the "/" in front of the servlets string.

We're using Modern.

 

Let me know if you would still like a screen share.

0 Likes
Message 5 of 6

catot
Advocate
Advocate

Here's an simple new APV that I set up to test on a different WS:

<div><!--<img src="/servlets/ImageServlet/?imageid=${item.itemDetails.sections[&quot;MySectionName&quot;].fields.MyImage.value}" alt=""/> --></div>

 This works for me.

0 Likes
Message 6 of 6

philipfrench
Collaborator
Collaborator
Accepted solution

I actually just found a way to stop it from removing the leading "/" on "/servlets", which is what Modern needs.

 

In the picture, you can see the img tag starts with "<" in the normal way.

However, if you remove this single "<" character with "&lt;" (without quotes) then the parsing of the tags is apparently confused, and the leading "/" does not get removed when you save.

 

Then it works (pictures display in Modern correctly).   

Thanks to Cato and others that contacted me via email.

 

apv_issue.jpg

 

 

 

replace like this:

 

 

apv_issue2.jpg