Is there any out of box SNOW(Service Now) api to create catalog item and its variables? - servicenow

For e.g. , I want to create a catalog items under a category named "Backpack".Let's say I want to create a "Catalog Item" named "American Tourister" under the "Category" named "Backpack".I want to add the attributes like "colour","type" of these catalog items in the form of "Variables".
I have these values stored in my database.And data gets add up in the incremental form in database.
Is there any "Out of the Box API" in ServiceNow to create "Catalog Item" and its "Variables" using that out of box api,so that I can create catalog item and variables using data in my database.

For the latest 2 version (Jakarta and Istanbul) yes there is a set of classes for creating and manipulating catalog items, catalog categories, variable sets and variables, (CatItem, CatCategory, CatalogItemVariable, CatalogItemVariableSet, CatalogItemVariableSetM2M) please visit the official documentation for the server side APIs
I don't know about the other version but in case they are not there you can still make use of the GlideRecord API to manually do all this stuff, for example:
var catItemGr = new GlideRecord('sc_cat_item');
catItemGr.initialize();
catItemGr.setValue('name', 'American Tourister');
catItemGr.setValue('short_description', 'American Tourister Stuff');
catItemGr.setValue('category', 'sys_id for the category Backpack');
catItemGr.insert();
The above snippet can be used to create a new catalog item programmatically, you can set up the variables, variable sets and the relations using the same way

Via the REST API Explorer you can use the Namespace sn_sc to access the Service Catalog API.
Use this path to get to it:
https://.service-now.com/$restapi.do?ns=sn_sc&service=Service Catalog API&version=v1
You'll find the available operations on this page.

Related

How to drop a class (table) in Back4app Dashboard

I'm new to parse and back4app. While I'm trying to delete a class (table) in the dashboard, I can't find any menu item that allows me to do it. Can anybody point me to the right direction?
Also related, is it possible to change a column's name after it is added, and is it possible to bulk update rows for certain fields, all within the dashboard?
Well, actually I just found part of the answer. The "Delete this class" menu item is in the top right Edit menu, as shown in this screenshot:
In order to delete the class, it must be empty, so you firstly need to delete all rows before deleting the class.
It's not possible to edit the column's name from the dashboard, so, what you may do is exporting the data and import your JSON file with the right name.
Another option that is not recommended if you're not sure about it, is updating the column's name through Mongo commands.
You'll need to update it in the collection (the class) and in the SCHEMAS too.
The connection string to help you with the mongo commands is available at Server Settings > Core Settings > Settings > MongoDB Database URI.

How to expose product data to Policy List on SPCRM

On SPCRM I'm trying to expose Product Name on the Policy List page, inside the column called: Insurance Type.
Using inspect and console tool I could not locate the missing data
I am logged in as this user:
https://spinsurance.admin.kademi.com.au/manageUsers/116783806/#summary-tab
Policy List page:
https://crm.spinsurance.co.nz/leads/?query=&leadType=active&from=0&size=100
The product data is only exposed once you click a policy (under Insurance Type section):
example: https://crm.spinsurance.co.nz/leads/148615383/
I would like to know where / how I can update the lead/policy query to also include product data (Insurance Type) within the Policy list page.
OK, so assuming you have a custom field on your journey to hold the insurance type, similar to this example which has a field called "claim_recordId"
Then the JSON response on the leads page will include that in the fields object, eg:
You can then customise the JS for the leads page to show that field in a column

How does Joomla create the Rules value in assets table?

I would like to know how does Joomla create the values in the Rule field in the #__assets table.
I believe that the files where they are created might be:
libraries\joomla\database\table\content.php
libraries\joomla\database\table.php
I have tried to find the code which does this but I either don't find it or what I do find just don't understand it. I need to know how Joomla creates these values in this field to be able to make my own process.
Every component controls its rules with an access.xml file. You will find these in the administrator/components/com_whatever folder.
Where specific rules are managed depends on the type of asset.
Component level rules are managed in com_config with the component mvc, meaning that when a user clicks the options button in the component they set the rules for the component.
Item level rules (such as for categories and articles) are managed in the form for those items via a field with type="rules."
Global rules are managed by com_config with the application mvc and the UI is in global configuration.
JTable manages storing this in the assets table.

How to join tables in HMVC?

I used MVC before. Now I am a learning HMVC.
I have product, product_category, product_description and product_images tables in my database.
I want to display list of products in my website with basic product information. Clicking on a product will redirect to a different page and will display all the product related information.
What is the best way to achieve this according to HMVC(Modular MVC) pattern?
Should I create different modules for each table like product module, product category module etc..?(In this case I will have one model class in each module/model. I found this idea when searching internet)
Should I create one module called products and put all the files related to this in that module? (In this case I will be having all the product, product_category, product_description product_images model classes under products/models)
Should I follow a completely different implementation from the techniques I've mentioned above? (Please provide specific details to build this module)
(I'm using codeignitor for my development)
Thanks a lot!
Lets simplify the things for you.
If you have category as menu (Same as magento), i will recommend you to create new module for cateogry
Coming back to product, you can manage all things with the 1 product controller.
In category, category will have its own model to interact with database.
In your product model, you can manage all kind of transactions in one model because they are part of product only.
If you want to move bit advance, you can have a sql folder in each module so that you can install the and create tables when you just drop folder to modules. For this you can create a small script where, in regular interval of time, it will check the new modules, and if that script found some new modules, it will install the .sql file in the sql folder, which will update the database schema.
Hope this will help you

how to create an ajax-driven auto-complete field in a sonata admin form in symfony?

I have a form generated with the sonata admin bundle. I want to enable a live search tip for my user on an input field. The proposition should come from a category table in the DB.
For example, if I have a field called company, when a user writes "a", I should suggest all companies whose name contains "a".
Use JQuery Autocomplete. On server side create controller action that will return suggestions through AJAX.
See example - http://jqueryui.com/autocomplete/#remote-jsonp

Resources