JSONObject["caption"] not found - servicenow

We are using form designer of servicenow to change elements on a form.
The table used to create the form is extended by the task table and contains a workflow with approvals and various stages.
When we try to change something within form designer, it does not matter what it is, renaming a field from summary to summarys for instance and clicking save.
The action gives this error:
JSONObject["caption"] not found
Only some forms are affected by this issue, for instance incident forms, change forms all open and can be changed and saved.
I have a feeling that this error is related to a known issue but i just wondered if anyone on here has seen it.
NB: It is not possible to share my JSON response because it's all done behind the scenes by servicenow. I am in a form design view and I am simply clicking save on a form change
Thank you for your time

This has now been resolved.
Turned out a title on a form header had more than 40 characters and this was causing the error on form save.
Max limit on a title

Related

Form and Report on same page (Form as detail of selected report page)

I am curently moving my small business app from ms access to Oracle Apex 20.
What I need is a page that shares both the report where I would select a row with record and form element at the top of page that would show details of the record.
Can someone give me an advice on how to start? I tried creating a blank page and inserting report and form elements manually but I am getting error No Primary Key item has been defined for form region rep7.
I suspect I need to connect the form and report with primary keys but don't know how. Closest I've been to solving my problem was watching this:
https://www.youtube.com/watch?v=H-hoMcMIs9g&ab_channel=MostafizMitul
but I couldn't quite decipher it.
Thank you
Jakub
The way you described it, it is a page whose type is Master Detail. Just follow the wizard, it'll create everything for you.
True - you can do it yourself, manually, but - why reinventing the wheel? The whole idea of Apex is to make things simpler for us, developers, to save us from boring actions we'd repeat over and over again. Let the wizard do it!

Which resources method should handle this view?

I'm currently using Laravel but i assume this question could also be asked with any framework in any language.
If i have a simple form to create an user, with the most basic fields (firstname, lastname, email...), the resource method i'll use will be create to display the view and store to handle the post logic.
After that, the edit form will be displayed in the edit method and the update managed by the update method.
Eventually, the user sheet will use the show method.
Now, imagine i have a view that combine both the edit and show purposes, i mean like a page with multiple tabs, where each tab display information about the user, some charts, some tables, a lot of stuff... but also an edit form in one of these tabs.
Which method should be used to display this view ? edit or show ? Since it acts like a show but also have a form to edit the user... i'm always asking myself and sometimes i have a hard time to figure out which method i should use.
This case often happens in back offices, where some edit pages looks like a dashboard more than a simple form, i'm sure you see what i mean ;)
Is there a convention about this ? Something like "if there is a form it's an edit, even if it mainly show information" ?

Export data from a list view using a button

I am building a simple admin-on-rest application. One of the features is the user to export the content from a list view. So far I have two possible approaches in mind.
Export based on the selected filters (my favorite).
Export based on the selected rows from the table using check boxes.
I guess two things are necessary to achieve that:
Be able to render a button somewhere in "list view": would be great to add an "export" button inside the "filters" section. I couldn't find a way to render an "export" button keeping the filters.
That "export" button would be able to get the filters (from the list view filter section) for creating my custom URL for downloading the data. Or if using check boxes, detect the selected rows from the table and export that data.
I have been looking for examples or following other colleagues questions and I coundn't come up with anything similar. Any info/example/project will be much appreciated.
This is quite solvable. The filter is stored in the redux form and can be accessed by any connected component. I am guessing you have an API endpoint available that you can ping with the filter data and that can then generate the file and respond with the file URL.
1) Write a connected button component. This should have a mapStateToProps method to access the current filter data
https://marmelab.com/admin-on-rest/List.html#actions
2) It should also dispatch an action that generates a POST request.
https://marmelab.com/admin-on-rest/Actions.html#using-a-custom-action-creator
IMPORTANTLY: You will have to think about how the file itself will get downloaded. Since you are generating the URL on the fly, it will not be embedded in the model data so you do not have access to it. You might have to hard code a file name and path into your components so clicking will always lead to a download. Though this is not as trivial as it sounds, as the file generation itself will be an async operation. I think clicking this button should lead to a redirect to a page where the download link is displayed.
Just to complement krunal's answer, there's a library called FileSaver that can take a json response and start a file save operation with its content, showing a file save dialog, or even download it directly to a file of your choice.

Composite Fields In MSCRM 2013

I have a question on the subject of composite attributes that I would be grateful if you could help me with.
I posted this before on other question blogs but got no response I am satisfied with.
I am writing JavaScript that will update the fields (i.e. address1_line1, address1_line2, address1_line3, address1_city, address1_stateorprovince, address1_postalcode, address1_country) in the composite (address1_composite). When the fields are updated the composite does not seem to update. I have to open the composite and close it again. Is there a way of doing this automatically in JavaScript?
I have tried the following ideas:
Idea 1:
Xrm.Page.data.entity.save();
This is recomended at http://community.dynamics.com/crm/b/magnetismsolutionscrmblog/archive/2013/10/22/working-with-dynamics-crm-2013-composite-fields-fly-out-menu.aspx
This is not any good as my customers want to view the composite before saving the page. Also I would not want to save the page for my customers as they do not want this. They would like to decide when to do this themselves.
Idea 2:
Xrm.Page.data.refresh();
This is not really what I wanted as I do not want to refresh the whole page. I just want to refresh the composite. Also it bring up a popup that warns you about not having saved the page which will be annoying for my customers.
Idea 3:
Writing the address from the address lines to the composite.
This feels like a nasty hack.
There is probably more than one way of doing this. I used the function
Xrm.Page.getAttribute("address1_composite")._attribute.setValueForCompositeField();
I do not like this for the following reasons:
This is a hack as it is not using the system functionality of the done button to write the data.
You do not get the system formatting you get with the done button although this will get done when the form is saved so it is not so bad.
In the future if customers are allowed to add their own composite fields it could cause problems as the field names could be different.
It requires me to write extra code for each form that has a composite which has fields with different schema names. E.g. I have to write different code for forms with ShipTo and BillTo addresses as the code for the account form will not work.
Another idea was to set the focus to the composite field after a change has been made to any of the fields inside the composite.
Xrm.Page.data.entity.attributes.get("address1_composite").controls.get(0).setFocus();
This is the best idea so for but it is far from perfect. This forces the user to press the done button and hence the fields will be written. I was hoping for something more automated.
My Question:
What would be great is if there was a way to click the composite done button in JavaScript. This would give me the formatting of the done button and the automation I need.
Update - 14/04/2014
Since posting this question I have been in contact with Microsoft and they say there is no supported way of clicking the done button via a program.
If the field is locked down CRM JavaScript does not send the data back to the server for updating. Another approach would be:
perform the update using JavaScript (so the user sees the change); and
use a server side plugin on the Update event so the value is persisted.

People Picker for MVC3

I am looking for People Picker Control similar to SharePoint one for MVC3 applications.
Can you please suggest if there are any such controls available?
What is the best approach to pick the people from AD in MVC3?
Requirement: On one of the Views, I need to select a user from AD.
I was thinking about People Picker kind of control.
Thanks
Arun
I know this is quite old so I doubt you still need this answered but perhaps it will be useful to someone else.
Just last week I had to build a control like does this for us. It's basically two main parts, a JSON service that accepts partial text and returns a list of suggestions and the HTML/CSS/jQuery+UI control.
The service is pretty straightforward so we'll skip over that here.
I'm in the process of doing a write-up on the web side but basically we wrapped the jQuery autocomplete with some custom CSS to make an input that is similar to the address line in GMail. This was done by styling a container div to look like a long input field. The actual input field is within that container and styled to be essentially invisible. Clicking in the container moves focus to the input box. Upon selecting a suggested name, I create a new container to insert before the 'cloaked' autocomplete input which contains the user name and a hidden input with our desired value to send along when the form is submitted. I had to do some other overloads on the autocomplete to get it to act consistently but essentially this is all there was to it.
The control looks at the container for a data-input-name attribute to figure out what 'name' to set the hidden inputs to when they are created with each user pick. When the form is submitted the default model binder rolls all the users of a particular picker (since you can have multiple on a page) into string arrays of the values - assuming your model has string array properties with the same name as used by the input controls - which we can then process on the server side.
By far the hardest part was figuring out the right HTML + CSS to get the look and feel right. I'm not a very strong UI person so this took me forever and still falls down in Chrome which seems to add an accent around input boxes even with (or because of?) styles which make it blend into the parent control.
For our purposes it's been working great over the last week.
UPDATE: It's now on GitHub with a Demo.

Resources