I want to use my same session and then finally at the end of this URL one two three four five six seven i want to set p 3dep no to the dep no column so, in other words, i want to go look at the department number for whatever person that I click on lips and the last thing here or well I’ll show you why this won’t exactly work save run my page okay you can see King president Aaron manager Blake manager right and in the mouse over you can see it’s a king president all right so i changed the tooltip I’ve changed the title and when i click on King president I should get an heir, oh I don’t oh this is awesome so this is actually wow that’s really cool so this is new with Apex 5 I was expecting this to break it appears that apex five now properly and we’ll add checksums two URLs.
So in previous versions of Apex if you were to if apex asked you to build a link like this in a sequel statement and it would potentially break if you had session state protection and you would have to do something like this apex until dot prepare URL and that would add the appropriate set session state protection which you still should do but it appears that apex will prepare the URL for you automatically I would still probably I would still explicitly do it like this so in other words whenever you have whenever apex or whenever you generate a link that goes to an apex page you should probably wrap that in apex until dot prepare URL I’ll put this in chat for you ok oh sure yeah yeah so see at the end of this URL um so that look at the code that I posted there and notice that it ends with p 3dep no colon and then some value so and actually, the URL ends.
This is the URL that we built this little section here notice that there’s more added to the end of the URL this is called the checksum and what this does it’s now by default in apex 5 session state protection is enabled and what that means is that I cannot just come over here and change the department number that I want to look at in the URL if I do this I’m going to get an error and it says whoa whoa whoa we tried to produce a checksum for the URL here that you’re at you’re trying to navigate to and it does not match this checksum that you provided I could then try to cheat the system here and I can say well I just won’t provide a checksum and a different air that says no checksum was provided but we kind of need one for the action that you’re trying to take so what this does it basically locks down our application from someone kind of getting clever with our URLs and looking at stuff that maybe they shouldn’t.
So, in other words, this checksum this huge checksum here right here is unique to this URL does that make sense and so and just to reiterate what apex is going to do when it starts to process this page it’s going to take this part of you it’s going to take this URL and it’s going to run it through just a hashing algorithm and if the hashing algorithm gives us this output we know that the URL has not changed if it gives us something different from we know hey the URL has been tampered with ha sorry not cool, so that’s how that works is very simple it looks much more complicated but it’s a very simple process okay so what we’re going to do now is we’re going to jump into the workshop and then we’re going to end the day after that all right so welcome everyone today two we’re actually going to start the day a little differently.
We are going to take a look at a question which was basically how do we create dynamic breadcrumbs in apex which is really a common question and/or it’s not an uncommon question I should say and it’s probably a part of many applications, so the example is I have this department and I have a form to edit a department which is going to be on page three and at current currently I don’t have a link already set up between this report and form so I’m going to cheat a little and I’m just going to build the link because we can do that so let me just say 10 Oh actually it’s going to break because and I require session state protection which is a good thing right so by default in apex 42 you could get away with this by default and button apex 5 they’ve changed the default settings to where you can’t do this so I’m just going to fix my report very quickly so that it will generate a link that apex won’t bark at.
So to do this, we’re going to talk about this in greater detail when we get to reports but I’m just going to skip ahead pretty quickly here I’m going to modify the department number column I’m going to change the type of column I don’t want it to just be plain text I actually I want it to be a link which means it’s going to go to it’s going to take me to another page by default no link’s going to be defined so I need to create one I know that my form is on page three so I’m going to go ahead and say this link should take me to page three and when you go to page three I want you to set the department number item which is the primary key field of that form to the department number of the current record that I just clicked I’m also going to add one more thing here I’m going to make sure that I clear the cache of page three in other words I want to make sure that I reset page three if it has any session state or any values.
I want those to be erased, and the last part is I need to provide text for my link and there’s a quick pick option over here on the right-hand side if I click on that i actually just want the department number for the link text that’ll be fine to let me go ahead and save that and run so my reports going to look almost the same except for now the department column is clickable and it should take me to my forum page so now I can view accounting and the original question was I don’t want this to say depth details I want this to say accounting because I know that this relates to accounting so to do that it’s actually not as difficult as you think I’m going to go ahead and edit page three and I’m going to go ahead and find my bread crumb and modify it so if I want to find a breadcrumb for this page.
I go to my page shared components just little the little triangle circle square I find the breadcrumbs and then here is the actual bread crumb metadata container and so if I right-click this I can say edit and here is the department details breadcrumb so, in other words, this thing here and what we can do is we can modify this by clicking on it and the short name instead of department details you can actually use substitution syntax similar to before and we can say what was a p3 I think d name and this is one way to do it I can apply changes refresh okay so we have home depth accounting, in other words, it grabbed the value of accounting now well what happens if I clear the cache for this page and let me say so if I cancel and oh I don’t have a create button and if the department number didn’t have a value it would show up kind of funny so let me go ahead and what’s the best way to do that Shh let me go to page three let me edit this and I’m just going to cheat real quickly here.