This post is a continuation of my previous article on the Tile Wizard API, where I described how we can use the Tile Wizard API to dynamically update the Tile Content.
In this post, we will see how we can use the Tile Wizard API for another similar and more common use case to display a dynamic image based on certain conditions.
For the purposes of this post, let us assume that we want to create a Tile called 'My Team' that displays a different image and live data based on the user's security role assignment.
Demo:
Tile Wizard Setup:
NavBar > PeopleTools > Portal > Tile Wizard > Create Tile
App Package PeopleCode Implementation:
PeopleCode for Reference:
import PTGP_APPCLASS_TILE:Tiles:Tile;
class TILE_2 extends PTGP_APPCLASS_TILE:Tiles:Tile
method TILE_2();
method getTileLiveData();
end-class;
method TILE_2
%Super = create PTGP_APPCLASS_TILE:Tiles:Tile();
end-method;
method getTileLiveData
/+ Extends/implements PTGP_APPCLASS_TILE:Tiles:Tile.getTileLiveData +/
If IsUserInRole("SV_CSK") Then
rem %This.setTileImageRef("SV_CSK"); /* Method equivalent */
%This.ImageReferenceField.Value = Image.SV_CSK;
/* Live Data */
%This.TileLiveData_1 = "Chennai Super Kings";
End-If;
If IsUserInRole("SV_RCB") Then
rem %This.setTileImageRef("SV_RCB"); /* Method equivalent */
%This.ImageReferenceField.Value = Image.SV_RCB;
/* Live Data */
%This.TileLiveData_1 = "Royal Challengers Bangalore";
End-If;
end-method;
In this post, we will see how we can use the Tile Wizard API for another similar and more common use case to display a dynamic image based on certain conditions.
For the purposes of this post, let us assume that we want to create a Tile called 'My Team' that displays a different image and live data based on the user's security role assignment.
Demo:
Tile Wizard Setup:
NavBar > PeopleTools > Portal > Tile Wizard > Create Tile
App Package PeopleCode Implementation:
PeopleCode for Reference:
import PTGP_APPCLASS_TILE:Tiles:Tile;
class TILE_2 extends PTGP_APPCLASS_TILE:Tiles:Tile
method TILE_2();
method getTileLiveData();
end-class;
method TILE_2
%Super = create PTGP_APPCLASS_TILE:Tiles:Tile();
end-method;
method getTileLiveData
/+ Extends/implements PTGP_APPCLASS_TILE:Tiles:Tile.getTileLiveData +/
If IsUserInRole("SV_CSK") Then
rem %This.setTileImageRef("SV_CSK"); /* Method equivalent */
%This.ImageReferenceField.Value = Image.SV_CSK;
/* Live Data */
%This.TileLiveData_1 = "Chennai Super Kings";
End-If;
If IsUserInRole("SV_RCB") Then
rem %This.setTileImageRef("SV_RCB"); /* Method equivalent */
%This.ImageReferenceField.Value = Image.SV_RCB;
/* Live Data */
%This.TileLiveData_1 = "Royal Challengers Bangalore";
End-If;
end-method;
how to migrate tile wizard
ReplyDeleteRefer following document on My Oracle Support:
DeleteE-FLUID : Migrate Fluid Tile (Doc ID 2213853.1)
You can use Data Migration WorkBench to migrate Tile Wizard tiles. PTPPB_GROUPLET is the delivered data set definition to migrate Tile Wizard data.
Navigation : Peopletools -> Lifecycle Tools -> Migrate Data -> Data Migration WorkBench
Where are the images - Image.SV_CSK and Image.SV_RCB placed?
ReplyDeleteI am trying to do the example stated here; so would like to know the place where these images are placed?
I uploaded the images (SVG format) using the Branding Objects page.
DeletePeopleTools > Portal > Branding > Branding Objects (Images)
We have created a custom tile that just displays few external links into it. But we are noticing that Image link and the description are not coming up in the same line. Any thoughts ?
ReplyDeleteHi Sasank, thank you for this tutorial, it's awesome.
ReplyDeleteI have a question, is it possible to add a hyperlink to a tile to point to different external page then the tile itself? For example can you make "Royal Challengers Bangalore" a hyperlink instead of just plain text?
You could set the Tile content as HTML using SetTileContentAsHTML and then manipulate the HTML using the App Class PeopleCode.
DeleteYou can review this post which might give you another option:
Deletehttps://pe0ples0ft.blogspot.com/2018/09/tile-wizard-api-dyn-target-page.html
Hello Shashank,
ReplyDeleteThis is really knowledgable :)
Initially i used a Free Text as the source and in the source I gave a Video Link , for ex-A you tube link.
When the Tile is displayed on the Home page, User can play the Video on the tile.
But My Question is :-
Now I want to use different Video based on different Roles.
Lets say If I login-I should see You Tube Video ABC and If My Manager Logs in, he should see Video DEF of you tube.
You have Told us about the images based on roles, about the target content based on roles but can this video thing be achieved?
Hi Sumit,
DeleteI have used Event Mapping on the PT_LANDINGPAGE Activate event to dynamically change the content of a tile in such scenarios.
The concept is very similar to a trick which I learned on this thread:
https://community.oracle.com/thread/4052095#thread-message-14430289
Sorry - I meant PT_LANDINGPAGE.PostBuild component peoplecode event.
DeleteHello Sasank,
DeleteToday Only I achieved what I was asking you but in a diff way and the way is what you suggested by using SetTileContentAsHTML.
I used this function and then i used %This.TileHtmlArea property to define diff You tube Links based on Roles.Something Like this:-
If IsUserInRole("DSX_Sumit") Then
%This.TileHtmlArea = GetHTMLText(HTML.TEST_HTML_SUMIT);
%This.TileLiveData_1 = "You are DSX_Sumit";
End-If;
If IsUserInRole("DSX_Sumit1") Then
%This.TileHtmlArea = GetHTMLText(HTML.TEST_HTML_SUMIT1);
%This.TileLiveData_1 = "You are DSX_Sumit1 ";
End-If;
And It worked too :) So your earlier suggestion also worked.
Please do you have example on Pivot Chart to be displayed dynamically on PS Tile. Preferable chart having bind values.
ReplyDeleteUnfortunately, I don't have an example that I can share with you right now.
DeleteHi Sasank, Can we change the title of the live tile based on the role assigned t the user?
ReplyDeleteIn the above example I want to change "My Team" based on user role
DeleteHi, Can we change the title of the live tile based on the role assigned to user?
ReplyDeleteHi , I know we can change TileImageReferenceLabel . but I am looking to change the tile title."My Team" in above example
ReplyDeleteYou cannot use tile api for that.
ReplyDeleteYou could try using event mapping on the homepage and try manipulating the tile title.
https://community.oracle.com/thread/4052095#thread-message-14430289
I have not tried this so I cannot confirm if it will work or not.
Can we set custom images to delivered tiles without updating the image property on tile using event hi, mapping framework?
ReplyDeleteHi, can we set custom images to delivered tiles without modifying the CREF property and using Event mapping Framework?
ReplyDeleteYou can use Event Mapping on the Landing Page to reference a different image.
DeleteThis post should give you an idea on how to go about it (not the exact same requirement):
https://community.oracle.com/thread/4052095#14430289