Skip to main content
April 27, 2023
Solved

Displaying asset images in a summary view.

  • April 27, 2023
  • 14 replies
  • 0 views

Hi, I am making an Asset Management application.

I have a functionality which allows me to create new assets with information such as asset name and asset Id. There is also an ability to add images of the asset in the interface where I have used the a!fileuploadfield which points to a constant which is a folder that stores the images. Here is the code for the same.

/*a!fileUploadField(*/
/*label: "Asset Image",*/
/*labelPosition: "ABOVE",*/
/*target: cons!G1_folderAssetImages,*/
/*value: ri!G1_Assets.imageId,*/
/*saveInto: ri!G1_Assets.imageId,*/
/*required: true,*/
/*validations: {}*/
/*),*/

I want to make a summary view (Interface) which shows all the information about the asset along with its image. But as of now I am just able to show the image id. Is there any way I can dsiaplay the image in this new interface?

Best answer by sanchitg0002

You need to put a!ocumentImage() in imageField(). Copy below code.

a!imageField(
  images: a!documentImage(
    document: ri!G1_Asset['recordType!{76ae75aa-111e-4d82-831b-66439437307e}.fields.{9b94dcb7-d02d-4a6f-8590-eaa380fe5792}'],
    altText: "Image"
  )
)

14 replies

April 27, 2023

You can use a!documentImage() and pass the document id in a Image Field Component.

April 27, 2023

But since I am trying to save the images in a folder, it doesn't work using a!documentImage()

April 27, 2023

So what?? all the documents are stored in a folder.
Can you share what you are trying and what is causing the problem?

gopalk2865
Participating Frequently
April 27, 2023

you can configure your interface something like below,

a!imageField(
  label: "Image",
  images:a!documentImage(
      document: your doc id
      )
 
)

April 27, 2023

I tried using this and replaced the document ID with my document ID. But I get this error:
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!imageField [line 91]: User Does Not Have Rights to Perform this Operation

mikes0011
Brainy
April 27, 2023

Mirroring my answer from above, in case it gets buried:

The Expression Guru