Changing media for a button by method

I have looked at crm and it looks simple but I cannot get this to work in my solution: all I want to do is set the media for a label on a form so that I can change the look of a button using a method.

When I trigger this method all I get is the text displayed (i.e. media:///client.png) instead of seeing the media file:

globals.button1=“media:///clients.png” (clients.png is a media file I have imported)

I have set the label to display tags, and the text of the label is %%globals.button1%%.

Where am I going wrong?

Hi there,

This is what I’ve found works for me. In design mode, select the original image and give it a name, in the name property, which then turns it into an element. Once it’s an element, you can use the following step to set it to any image you want:

elements.myElementName.setImageURL(‘media:///clients.png’);

If you go to the How To section of the forum, I posted a tips and tricks solution that has a bunch of little tricks like this.

Hope this helps.
Adam

Thanks Adam - works a treat!