Servicenow - Service Catalog Reference Field - Insert different column than the display value - servicenow

Let me describe my problem:
I have a table for all my IT-Services. I reference to this table more than once, for different purposes. Most of the time I need to reference to the name of the service. That's why I keep the name as displayed value.
One Column of that table is a service_id (custom field) which is for example "Service_004". Now in a catalog request Item the User has to fill in the service_id in a reference field.
But since I have the name as displayed value, and I need it in other forms, I am unable to reference to the service_id.
Using the variable attributes field I managed to let the service be found using the autocomplete function. But in the reference field I still get the servicename. I know that I can change the display value in the dictionary, but this breaks other functions. So what I need is to change the display value just for one reference field.
Also I tried to create a new table called IT-Services2 with reference to my table IT-Services. Then I switched the display to true in the new table for my service_id, but this will even change it in the parent table.

Perhaps an onChange client script utilizing g_form.setLabelOf() ?
http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#setLabelOf
Maybe I'm not fully understanding your question...

I ran into this issue before, what you can do is create select box variable and use an on load client script to populate the list with the service_id(s) from the table you are referencing.
I would write a script include to pull the data from the table and call it from the client script via GlideAjax.

Related

Can :xdo_user_name be used in list of value in Oracle bi publisher? Or just works in data set

I am making a data mode. Involve a list of values to bind with parameter. Just want to ask if adding :xdo_user_name as the list of value sql parameter is possible?
I am hoping that user login, the menu will only show related data to him.
Many thanks.
Not sure if this can work or not.
You could create a List Of Values - Type SQL Query
select :xdo_user_name as USER_ID from dual
Now create new parameter of (parameter) type Menu and based on the above LOV. Next, in your datamodel you can use the newly created parameter any way you need.

Form WHERE clause

I have an APEX form I'm developing for "user settings". I have a table with a sequence as a primary key and the users ID in another column...in addition to a few columns where each users saved settings are stored (things like "N" for do not receive notices).
I haven't used Oracle APEX in a while so excuse this likely newbie question...The insert works fine, but I'm having trouble with making the form only show the current users values. In my Form Region the source is set to my Table, and I have a WHERE clause like this:
USER_ID = 813309
But that's not working (813309 is my id and I'm just hard-coding it for now). The form always comes up with a "New" record.
For a form to load a specific record you can set the primary key page item to the value you need. You can do so in the url using the link builder from another page or you can set a computation on the item. That is what I would try in your case: add a computation to your item P_USER_ID of type "Static Value" with value 813309. Make sure the computation happens before the "Fetch Row" - the value obviously needs to be set before the process runs.
In such cases, I prefer creating a Report + Form combination (using the Wizard, of course): it creates an interactive report (so that you can review data in a table), and a form which is used to add new records or update/delete existing ones.
Doing so, when you pick a user in interactive report and click the icon at the beginning of a row, Apex redirects you to the form page, passing primary key column value to the form which then fetches appropriate data from the table.
Not that it won't work the way you're trying to do it, it's just simpler if you let Apex do everything for you.
So: did you create an automatic row fetch pre-rendering process? If not, do so because - without it - Apex doesn't know what to fetch. Also, if you hardcoded user_id, it won't do much good. Consider storing username into the table so that you could reference it via :APP_USER Apex variable.

DATA_LENGTH_0 in maintenance view

I created a view for a client-independent customizing table. The primary key consists of three components - first one being a secondary key on a check table. It is also used to form subsets of the table data. Altogether, it looks something like this:
Column Key
------ --------
frmd Secondary check table and Subset
attr1 KEY
attr2 KEY
url
But everytime I try to insert a new key combination, the view dumps with DATA_LENGTH_0 CX_SY_RANGE_OUT_OF_BOUNDS, because the report tries to access a string. Apparently it is somehow related to the field generictrp being set. What does this flag tell me and how do I change it? Also non-key components like url are not being fetched - the column is totally empty.
Modifying the customizing table via transaction SM30 works fine, but I don't want that ugly first column.
I've tried to recreate the view multiple times and I also compared the settings with existing customizing views.
Access is set to read,change, delete and insert
Display/Maintenance is allowed
Selecting everything from the View with SELECT works fine
EDIT
Picture 1: what I have
Picture 2: what I want; without the first key column...
The most likely reason I faced this problem, is that I had a foreign key of type i. I changed the type to n and regenerated everything.
Seems to work for now.

Show Order ID in Dynamics CRM Order Look up instead of Order Name

In Dynamics CRM 2016 (on-prem), I've custom child entity Partiesthat have a look of type order. Currently it is working properly and it is showing order name but I want it to show Order ID.
I tried to resolve by creating my own view, adding order id field only and making it default view for the look up but it don't meet my requirements.
This is controlled by the lookup view for Orders. The first three fields in the lookup view are shown when selecting records from the lookup field.
You cannot change the position of (or remove) the Name field from the lookup view. That still leaves you with two additional fields to be shown, one of which could be the Order ID.
I know no supported ways around this (except creating a workflow to copy the Order ID to the Name field and adding a custom name field instead, if you really insist).
Changing what appears on the form after you make a selection in a lookup field is not possible, unfortunately. The primary attribute is always what gets displayed after a user specifies a lookup value (which, for the Order entity, is the Name attribute). As Henrik's answer mentions, people commonly get around this by copying the value they want to see into the primary attribute using a workflow or a plugin.

How do I use Spring Roo for referenced data

I’m new to Spring Roo and looking to build an application. I need to have combo boxes to select values into string fields – a fairly common requirement. The Spring Roo Pizza example shows this using enumerated data types enum constant, but I require the source values to be editable by an admin (ie in a table) so we can change the values in the future. Further, my preference would be to use a single table to contain all these lists for easier maintenance.
I know the SQL I want to generate the list would be something like:
Select listvals FROM listTable WHERE listtype = “status”;
Then, my dropdown box would show something like: Active, Inactive. The user would select one, and the string “Active” would be stored in the target field.
And in a second example, we might use:
Select listvals FROM listTable WHERE listtype = “State”;
The second dropdown box would show something like: Alaska, California, Florida. The user would select one, and the string “Florida” would be stored in the target field.
My CORE question is how does one achieve this sort of function in Roo?
Using the Pizza Shop quick start as a sandbox I have tried defining the target fields such as:
I changed: field reference --fieldName base --type ~.domain.Base to:
field reference --fieldName base --type ~.domain.Base --referencedColumnName name
Which returned this error:
#JoinColumn name is required if specifying a referencedColumnName
The initial problem is that at this point roo has yet to create the row ID columns for the db, so I don’t know the name of the join column on the Base table. But, if I wait until after I run the script with a 1:M join, the column pizza.base will be defined as an integer, and not the string that I want.
So, I ran the vanilla pizza shop roo script and interrogated the vanilla db. (Does roo generate an SQL script for db creation that I could look at?)
As it turns out, roo names the row id column “id” as a BigInt. (I also note that it doesn't seem to make use of the SEQUENCE feature that postgres recommends for primary indices / row Ids.)
So now I run:
field reference --fieldName base --type ~.domain.Base --referencedColumnName name --joinColumnName id
Roo likes this!
Until I perform tests where it throws out a number of undecipherable errors in the Surefire reports.
I note that solving this problem is only step 1 to meeting my overall requrement described above. Step 2 will be to try to inject some sort of filter or where clause into the reference statement. I suspect that this has to do with the --fetch option (Roo support docs (http://docs.spring.io/autorepo/docs/spring-roo/1.2.5.RELEASE/reference/html/command-index.html#command-index-finder-commands - The fetch semantics at a JPA level; no default value)
But, I can’t find an example of this to see if I’m on the right track or to model my ‘fetch semantics’ – whatever those are.
Another possibility might be to use field list to define a class containing my list of dropdown values. This has a similar modifier --fetch, but again I can’t find any examples.
I’d really appreciate some help in answering my CORE question above.
THANKS!
Fetch parameter indicates whether the association should be lazily loaded or must be eagerly fetched (https://docs.oracle.com/javaee/6/api/javax/persistence/ManyToOne.html#fetch()).
Maybe the error of tests can be because you try to find, create, delete or update elements with related elements that not exists. Check this first of all.
You can see an example of application created with gvNIX (distribution of Spring Roo) that contains relationships between some entities on https://github.com/DISID/gvnix-samples/blob/master/quickstart-app/quickstart.roo

Resources