Important Update: Community URLs redirect issues are partially resolved. Learn More. .
2018-03-22 09:00 AM
Here is our use case:
In many of our applications users have to select a type first to proceed with the next step. It would be helpful to provide links to create a new record for each type, e.g. Create new task, create new defect, etc. without using a separate application for each type.
I am wondering if the New Record link can be modified to do this. Here is the URL behind the New Record link:
<archer-server>/RSAarcher/GenericContent/Record.aspx?id=0&moduleId=123
Does anyone know if there is a possibility to add a parameter to the above link in order to set a specific values list value?
Maybe something similar like with the navigation menu filters:
/RSAarcher/SearchContent/Search.aspx?View=Filter&fieldId=16721&filterType=ValueList&filterValues=82833&moduleId=438&formatType=ColumnFlat&reportId=5434&isNavMenuReport=true
I tried to combine both links without success.
Thanks,
Markus
2018-03-22 09:42 AM
Markus the application doesn't understand the added attributes to the URL and parse them.
But what you can do this with a custom object, added below.
fieldId is the field id of the values list you want to change.
paramName is the attribute (query string) in the URL the custom object will look for.
The value of the paramName would be the value id you're going to set the values list to.
So the URL to a new record would look like this (sans changing the moduleId),
https://baseurl/RSAArcher/GenericContent/Record.aspx?id=0&moduleId=75&requestType=71531
So the custom object is looking for the 'requestType' (base on the value of the paramName variable) in the URL and taking the value, 71531 and using it to set a values list in the record.
<script type="text/javascript">
var queryParameters = null;
var fieldId = 19810;
var paramName = "requestType";
$(document).ready(function () {
if (getParameterByName(paramName) != '' && getRecordId() == 0) {
setTimeout(function() { // making IE happy (and sometimes Safari)
var valueArray = new Array(1);
valueArray[0] = getParameterByName(paramName);
ArcherTech.UI.GenericContent.GetInstance().setFieldValue(fieldId, valueArray, '');
}, 500);
}
});
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
</script>
Advisory Consultant
2018-03-22 09:42 AM
Markus the application doesn't understand the added attributes to the URL and parse them.
But what you can do this with a custom object, added below.
fieldId is the field id of the values list you want to change.
paramName is the attribute (query string) in the URL the custom object will look for.
The value of the paramName would be the value id you're going to set the values list to.
So the URL to a new record would look like this (sans changing the moduleId),
https://baseurl/RSAArcher/GenericContent/Record.aspx?id=0&moduleId=75&requestType=71531
So the custom object is looking for the 'requestType' (base on the value of the paramName variable) in the URL and taking the value, 71531 and using it to set a values list in the record.
<script type="text/javascript">
var queryParameters = null;
var fieldId = 19810;
var paramName = "requestType";
$(document).ready(function () {
if (getParameterByName(paramName) != '' && getRecordId() == 0) {
setTimeout(function() { // making IE happy (and sometimes Safari)
var valueArray = new Array(1);
valueArray[0] = getParameterByName(paramName);
ArcherTech.UI.GenericContent.GetInstance().setFieldValue(fieldId, valueArray, '');
}, 500);
}
});
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
</script>
Advisory Consultant
2018-03-22 09:58 AM
David, you are a star! This works like a charm. Thank you!
2018-03-23 09:27 AM
Dang, David! How much do pants that fancy run a fellow?
WELL DONE!
2018-09-18 03:00 PM
I could not get this to select the value in 6.4.0.2. Should it work in that version as well? Also, will it work if that field is used to apply conditional layouts based on it's selection?
2018-09-18 03:15 PM
It should work in all versions Kyle.
Yes, it would trigger a rule if the value is changed in this method. I have one customer that uses it for determining an incident type based on link the user clicks on their intranet site.
Above line 24 you can add alert(results); and see what being returned based on the querystring parameter and it's value.
Advisory Consultant
2019-04-05 12:35 PM
Thank you for sharing this! This made my week!! I got this to work in 6.1 P2
2024-01-14 07:14 AM
Hi David,
Thank you for sharing this. I'm using 6.13 archer and in edge browser (Version 120.0.2210.121) . If I put this custom object on layout (with changing field id etc as needed) the page after login navigates back to home page. If I use the URL till here, it takes me to new record page
https://baseurl/RSAArcher/GenericContent/Record.aspx?id=0&moduleId=75, but if I append the string of request type it takes me back to homepage. can you please guide what I might check/verify.
2024-01-16 08:31 AM
@RupaKanakala1 what is the string are you appending to the end of the URL?
Advisory Consultant
2024-01-16 09:31 AM