Get URL Parameter in Content Management IFrame URL block

Rick Forristall
Tera Guru

I'm creating a CMS section for our Human Resources division and I want to be able to pass a URL with a sys_id to a user and when the user goes to that URL a specific record opens in an iframe in the CMS.

 

In the IFrame's URL block is there a way to grab the passed sys_id from the URL? (The frame name is gsft_main.)

 

For example, I want to have a URL like this:

 

my_instance.service-now.com/hrss/review_file.do?sys_id=hash

 

in the review_file page's Iframe, I want to load the record based on the URL's passed sys_id value so the user can review and update the record.

 

Thanks in advance for any help.

 

Rick Forristall

Goodwill of Central Arizona

1 ACCEPTED SOLUTION

Hi Rick,



Sorry, I seem to have misunderstood your requirement.   Content Management > IFrames are for static URLs.   Dynamic properties can not be passed to them in that way.



What you will likely need is a Custom Content Type as it appears as though you are linking to records on a custom table.   To create a Content Type successfully you will need to create:



1.   Content Type: See the incident content type as an example (Creating Content Types - ServiceNow Wiki)


2.   Page Detail Settings: This provides the dynamic iFrame you will need


3.   Detail Page: This is the CMS page that will include the Page Detail block above.   It also provides the URL you will link to



Once you set this up, you will be able to pass the sys_id parameter in a url similar to the following:



<instance name>.service-now.com/ess/<page_detail_name>.do?sysparm_document_key=<table_name>,<sys_id>



Example:



<instance name>.service-now.com/ess/incident_detail.do?sysparm_document_key=incident,46e18c0fa9fe19810066a0083f76bd56



Email Notifications - ServiceNow Wiki



Edit:   Above is the documented, standard way.   You could technically shortcut this by creating a page and a custom dynamic block.   The dynamic block could use the RP method above to get a sys_id parameter and pass it into an iFrame tag's url.


View solution in original post

8 REPLIES 8

Thanks Travis,



I used the shortcut method with a custom dynamic content block and added an Iframe - here's the source for anyone else's use.



============= START dynamic content block source ============================


<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


<iframe   style="width: 100% !important; height: 800px !important;" border="0"   frameborder="0" scrolling="no" id="hrss_review_a_job_requisition" name="hrss_review_a_job_requisition" width="100%" allowtransparency="true"   src="u_gica_job_requisition.do?sysparm_query=sys_id=${RP.getParameterValue('sysid')}"></iframe>


</j:jelly>


============= END dynamic content block source ============================



thanks again!



Rick Forristall


Goodwill of Central AZ


URL   that you provided helped me to resolve my issue, Below URL was used in our incident default client template, so if someone sends email out from incident, in the email body is incident number displayed and by clicking on the number, user is rerouted to portal to incident detail, thank you



/Petr


<a href="/ess/incident_detail.do?sysparm_document_key=incident,${sys_id}">${number}</a>


Awesome, thanks for the information guys. I had a similar challenge to pass custom made parameters into an IFrame that was displaying a form that runs a Client Script to get those parameters, and that was constantly failing until I switched it to Content Block as described and that worked perfectly, thank you for sharing that.


I am new to ServiceNow. Could you please provide more details on how to fix this issue.


Can you elaborate the steps you have provided with the settings screenshot?