Well I know its not a critical thing for a web application but I am trying to show user image on top of the app header or User intro using javascript just like you have in knack support website.
I have an image field in user object where my users have uploaded their profile pics. The problem is I don't know how to retrieve the image asset link using javascript. I don't even know if its possible using get user attributes.
Can anyone please point me to right direct if not the complete solution. I will really appreciate.
To make dynamic links you can use text formula to re-create the unique url and then a conditional link field to store the result in link form. See these pics for an example.
As far as the get request you can get the user attribute for email and save as a variable and then use filters in your ajax request to match that Variable to the email field on the object. This will help you locate the record then return the image link field value. Here is an example of using filters from the knack dev docs.
Thanks for the reply. I think you are right about the approach but I am not so good in JavaScript.
But I was able to record the second string (Amazon GUID) in a field. In User object I created a new link field and put a conditional rule on it to record value of the original image field and it gives you back the second GUID. But here is my problem i have three GUID in my image link which I have figured out as below.
Now I don't know how to write the code to get all three GUIDs to generate Image link using JavaScript. Also my Image is stored in role object not the main user object. So I was trying use JavaScript Utility Functions in Knack developer docs but it does not give you field values of roles right now.
Can you help me to //GET parsed url for image location from logged in user/field. part of the code and I think I can figure out the rest code.
I hope this is helpful. Before you can write the GET request for the image You'll need to parse the url where the image is stored so you can recreate it.
So double click on an image example to get the url. It should look something like this.
as well as the end portion: /original/fieldname.png
The first guid you see is your application ID. (984f3c1570b8cf5554ktt927) I've changed it here for security.
The second string - I cannot identify - it doesn't look like the knack record id so I'm guessing it is an amazon guid for the image record.
If you can figure out how to record that GUID upon record creation and save to a field on the user object then you can reconstruct the image address in a link field within knack and retrieve it when you want to. This will be the tricky bit. It might not even be possible.