How to populate fields of an online form - forms

I created a custom record (child of Inventory item) and an online form.
The final goal it's to send a link to a user (not a netsuite user) to display the different informations of this custom record. The user will be able to update some values and submit the form.
I saw it's possible to link a script file to this form, but I need the ID of the record to load it and populate every field of the form.
With normal forms, we have the internalid of the record as an URL param but in this case there is nothing in the URL .
Do you know any way to achieve that ?

A solution for the final goal could be:
Create an empty Suitelet (provides external link for User). Or refer to step 4 for contents.
Stored on the Custom record or via script (created in step 3) you can add to the external link, to include the record type and id as url parameters (&recordtype=customrecord&recid=12345). Be sure to avoid reserved parameter names.
Create a UserEvent, Client, or Scheduled Script to send email to User based on your requirements (in the email include the custom external suitelet link). User will click on the link and land on a NetSuite looking webpage (not requiring credentials).
Modify empty Suitelet. Suitelet should when context.request.method===GET: get parameters, load record(s), get data from record(s), create form, display data to User, display fields for User to enter data, add submit and refresh/cancel button, write/display the form with all fields. Upon submission (when context.request.method is not GET) you can use record.submit method to update the custom record(s).
NetSuite Suite Answer Id 74607 has a Sample Custom Form Suitelet Script from that can be very helpful.

Related

Power apps set button visible if user email is the same as requestors email

I have a form request and i want to let someone edit only his own request except from me and my team that we can always edit. So I need to set edit button visible only for my team and the original creator of the form. I used the user.email to get the email of the user who uses the app but I cant use equality netween this variable and the data card value as its incompatible user type. Text with table. How can i get the email in the data card and compare it to the users email?
actually it's quite easy, your requestorEmail should be coming from some datasource like sharepoint record or datavererse or so on.
You can get current record and then it's property requestorEmail convert it to Text using Text function.
you could also try ThisItem.requestorEmail and with text function you can do so.
Ms Docs should help
In addition if you could show/add code for your requestorEmail data card, I can try to provide exact function to extract email. but above info should lead you in correct direciton
I used on change action of the datacard and used set global variable varUserEmail to thisitem.requestoremail . Then i set the button visible if the user email = varUserEmail.Email . So in this way everytime the email changes to the email that is supposed to edit the request the buttons are visible for editing or deleting the report.

What is the best way to create a form with a confirmation page?

I would like to create the following form:
Step 1: The user enters his contact details.
Step 2: A confirmation page, where the user has the possibility to confirm or edit his entered data again (back to step 1)
The contact details are stored in an entity domain object. The properties have annotations for validation.
My problem:
When I pass the contact object to the confirmation page, I get the message
Could not serialize Domain Object Vendor\Extension\Domain\Model\Object. It is neither an Entity with identity properties set, nor a Value Object.
I understand that I cannot pass a non-persistent domain object. A tip I found was to convert the object to an array and back again later. This works to display the input on the confirmation page. But if the user edits the data, I lose the validation functionality when converting to an array.
Another possibility would be to persist the object already after step 1 (temporarily?) . The problem here is that the data must not be displayed in the backend (they are not yet confirmed). In addition, unused data is created if the user cancels the process.
Is it possible to save objects temporarily?
What is the most elegant solution to this problem?
If you only wan't to create a form, why don't you use a form plugin like Ext:form or Ext:powermail? These have a summary page by default. And you have the possibility to write the entered data into you're database.

How to get existing value from form to another magento 1.9

I have two different forms , one including user information and the second one have a grid. What I need to do is to get the email from first form to use it in the controller of the 2nd, there is a way or I need to get the value again from database?
you can try sending the email value through ajax when it is set to the other controller by adding parameters in the url or u can store email in a table(hope both tables are for same product or customer) and load it in other form using the id.
Hope it helps....

RESTful URI structure for fetching the same form in different modes

I am designing an application that needs to dynamically load a form via an AJAX request. There should be three "modes": "create user", "update user", and "view user" (readonly).
However in all three cases, I am fetching a resource - thus these should all be GET requests (I'm not talking about the URIs I use to actually submit the form). They're all (virtually) the same form, so I consider them to be the same resource.
It seems to me that I could do something like:
GET /forms/users // Get a blank form for creating a new user
GET /forms/users/u/1?mode="view" // Get a form that shows info for user 1
GET /forms/users/u/1?mode="update" // Get a form that allows updating info for user 1
Or something like:
GET /forms/users // Get a blank form for creating a new user
GET /forms/users?id=1&mode="view" // Get a form that shows info for user 1
GET /forms/users?id=1&mode="update" // Get a form that allows updating info for user 1
Would either of these be "correct" according to REST? Or should I do something else?
The URL should be describing the resource, something like:
GET /forms/info/user/new // form to create a new user
GET /forms/info/user/1 // form to view user 1 info
You can pass a query string parameter to make the form updatable. Ex:
GET /forms/info/user/1?updatable=true
But that sounds like a browser, not a REST concern. REST is for communicating with API, and updating the user info would just require a PUT verb instead of the GET.
So just add some javascript code to make the form editable by a user.
Use the GET for "view user" operation and to get the user properties, use the PUT for the "create user" operation and for "update user" operation use the PATCH. This is the way I used to do.
It's an unusual practice to get a form from the REST API, having the client side application to show entire forms fetching from the API.
In your case you're right I guess, the only alternative I can see is
GET /forms/user/add // Get a blank form for creating a new user
GET /forms/user/view/1 // Get a form that shows info for user 1
GET /forms/user/update/1 // Get a form that allows updating info for user 1

Implement Inbox Functionality in custom cq component?

We want to develop a smooth-flowing workflow experience (but still use workflows). Currently, a user needs to use the sidekick to initiate the workflow, then to the inbox, which takes them back to the page to use the sidekick again. When they go to the inbox, they need to restrict to the model and path of the page. It would be nice for the user to only have to go to the content page and from there, launch the different workflow forms that need to happen, like a little "inbox" right on the page that is subject to the workflow.
I have written a custom component that can initiate the custom workflow. The custom component can also query the WorkFlowSession and obtain any active WorkItems for the current page that the component resides (using the WorkItemFilter interface). What I want to do is provide a link to the user to the next step in the workflow from the custom component, just like the inbox does.
Here is an example output from an WorkItem instance toString method:
21.05.2014 09:45:29.300 *ERROR* [0:0:0:0:0:0:0:1%0 [1400679929160] GET /content/test/mailing1.html HTTP/1.1] org.rand.whatcounts.EmailCampaignCoordinator Found workitem: -----------------------------
WorkItem Id: /etc/workflow/instances/2014-05-21/model_1400679794564399000/workItems/node4_etc_workflow_instances_2014-05-21_model_1400679794564399000
Workflow Id: /etc/workflow/instances/2014-05-21/model_1400679794564399000
Payload: /content/test/mailing1
Payload Type: JCR_PATH
key = historyEntryPath value = /etc/workflow/instances/2014-05-21/model_1400679794564399000/history/1400679924113
key = comment value =
My hope is that by using the workflow api items, I can create the link that the user could click on to proceed in the workflow (just like the inbox).
Thanks for listening!
Phillip
There are two ways to implement this
Java-Based Solution
I was able to figure out one way by looking at
http://localhost:4502/libs/cq/workflow/components/inbox/list/json.jsp
The important part of this jsp is that, given a workItem instance, you can get the path for your next step using the JcrPathBuilderManager:
pathBuilder.getPath(wi);
Using this, I was able to output a link to the next step in the workflow to the user (without having user go to their inbox).
Javascript/JSON Based Solution
I didn't go far with this solution (I didn't write any js) but this was my fall back position if I didn't find the java-solution listed above. Once could implement custom JS in CQ Component that would call the json feed for the user inbox, do some client side filtering (to restrict it to only items related to current page). The URL to the feed is
http://localhost:4502/libs/cq/workflow/content/inbox/list.json?start=0&limit=40
Thanks!