Add current user to multi person combobox in PowerApps - sharepoint

I need to update multi person combobox with current user account.
I tried to collect previously saved data from SelectedItems property of current SP list record and then merge it with current user's claims via Collect function, but combobox somehow stays empty.
ClearCollect(colUsers, DataCardValue1.SelectedItems);
Collect(colUsers, { Claims: "i:0#.f|membership|" & User().Email, DisplayName: User().FullName });
colUsers property set as Default for DataCardValue1 control.
After that I tried to create a table and assign it as a DefaultSelectedValue for combobox.
Set(colUsers, Table({ Claims: "i:0#.f|membership|" & User().Email, DisplayName: User().FullName }));
It is working, but now I see only my name in combobox. How can I add all existing Users and merge them with colUsers table?

Related

Acumatica Mobile - Is it possible to make a Container with a value of a field displayed together with the container name?

I'm new to Acumatica and I was wondering if this is possible to make in Acumatica Mobile App.
I have created 3 custom fields in the Customer screen where it can calculate the total amount of AR Invoices, Hold Checks, and Voided Payments of the customer.
I want it to be displayed in mobile app just like the images I have attached.
The first image I have attached shows where the Customers list and it should display the Name of the Customer together with the TotalARBalance field. The second image shows if you select a specific Customer it will display its total amount of TotalARBalance, TotalHoldBalance, and TotalVoidedBalance with its Container Name accordingly.
This is the Customers screen in Web App:
This is my code for the Customers screen:
add screen AR303000 {
add container "CustomerSummary" {
add field "CustomerID"
add field "Status" {
forceIsDisabled = True
}
}
add container "ARInvoice" {
add field "RefNbr"
add field "Status"
add field "Balance"
add field "DueDate"
}
add container "HoldChecks" {
add field "PaymentRefNbr"
add field "DateOfHold"
add field "PaymentAmount"
add field "ExtensionDate"
}
add container "VoidedPayments" {
add field "ReferenceNbr"
add field "VoidStatus"
add field "PaymentAmount"
add field "DateVoided"
}
}
I tried to look in the Documentation for Mobile Framework Guide but I found nothing similar to what I want to make
I think you have two questions here:
Adding the TotalARBalance custom field to the Customer List Screen (AR3030PL).
-Make sure the TotalARBalance custom field is visible in the UI web screen.
-Get the proper name to be used in the MSDL Code (Mobile customization) for this field. In order to do this you must check the WSDL Schema for that screen (AR3030PL).
-Then make sure that you set the proper value to the fieldsToShow property for your Result container, see below:
add screen AR3030PL {
add container "Result" {
fieldsToShow = 5
containerActionsToExpand = 2
add field "Field1"
add field "Field2"
add field "Field3"
add field "Field4"
add field "TotalARBalance"
add containerAction "editDetail" {
behavior = Open
redirect = True
}
add containerAction "Insert" {
icon = "system://Plus"
behavior = Create
redirect = True
}
}
}
About the container with custom field's values.
Out of the box I don't think the Mobile app could render the exact same design.
You could create a group with the same names as you showed in your image but the field's value won't be displayed when the group is collapse. However, if the user uncolpases the group then they will be able to see the custom field's value for that group.
See below quick snippet for the AR Invoice group in your image:
................
add group "ARInvoiceGroup" {
displayName = "AR Invoice"
collapsable = True
collapsed = True
add field "TotalARBalance"
}
#add other two groups here
........
You can review more information about groups on this help article below:
https://help.acumatica.com/(W(1))/Help?ScreenId=ShowWiki&pageid=37c0e79c-e89e-4e41-8b05-ca3df5e053f1

How to move sublist fields created from User Event script

I added a sublist field on a transaction. For instance a Sales Order. When you add the field via user event script, it positions the field at the end of the sublist. Is there a way to position the field? This can't be accomplished in the UI as the field is added via script. It's a select type field, so I am trying to modify the list values with client script and can only do that if the field is created in my user even script. My code works perfectly fine, it's just the field is at the end of the sublist line(far right and have to scroll). I am using SuiteScript 1.0 but am open to using 2.0 if I need to.
This is for suitescript 2.0
This has sort of turned into two questions so I will give an answer for one and then the solution, for clarity. The short answer is you cannot move a sublist field when created in a user event (however there is a solution to that.)
you can add a sublist field by getting the sublist and using the sublist.addField method.
function beforeLoad(context){
var form = context.form;
var sublist = form.getSublist({
id : 'item'
});
sublist.addField({
id: 'fieldid you want to use for script reference ect.',
type: serverWidget.FieldType.CHECKBOX, //any supported TYPE
label: 'Label users will see in sublist'
});
}
If done this way, there will be a new column on the end of the items sublist that cannot be moved.
To be able to move the location of the column do the following.
Navigate to
Customization
Lists, Records, & Fields
Transaction Line Fields
add a new field and apply to the sublist you want it used on.
you can assign and id which will be prefixed with custcol so start your id with an _ and give it a name.
Once this is complete you can access the field by id and change the value in your user event script before load
function beforeLoad(context){
var form = context.form;
var sublist = form.getSublist({
id : 'item'
});
sublist.setSublistValue({
id: 'customcol_id_created_in_ui',
line: 1, //line you want to access if needing to set all you will have to loop through and set each one.
value: "your value"
});
}
If you go to the API reference and look at the ui/serverWidget module and navigate to sublist you can find all of the methods and options for manipulating sublist there.
In SuiteScript 2.x you would use the N/ui/serverWidget module, create the field and then use the Form.insertField(options) method, passing in the field you created as options.field and the existing field which you want to insert your field before as options.nextfield. Note that Form refers to the form object passed to the user event script in the scriptContext.
i don't believe there is a SS1.0 equivalent.

Kentico Admin - Dynamically Change and SAVE Field Name, Value and Label

For a custom page type, I have a multiple choice form filed as seen in image 1 and 2. I was able to set it up (using jquery) so that when I click on other checkboxes belonging to a another field, the checkbox Label and value of this field is changed accordingly as seen in image 3 - 'Author1', 'Author2', 'Author3' were replaced with something else.
The problem is when I hit the Save button, all of my new label/value are not Saved, but the checkbox value and label return to its original value.
Is there a way to make it so that these checkboxes can accept new value and the new value can be saved. Thanks!
Where does authors values come from? Database? You should be able to use SQL query as data source for multiple choice control. This will allow you to store actual values into database whenever you save a page on the Form tab.
So the idea is to load actual values, replace them with 'AuthorN' and change back to original value when checked.
I've set up an example which might help you. I've created a form with three fields:
FirstAuthor
Type: Integer
Form control: Radio buttons
Data source: SQL Query (select userid,username from cms_user)
Has depending fields: true
SecondAuthor
Type: Integer
Form control: Radio buttons
Data source: SQL Query (select userid,username from cms_user)
Has depending fields: true
OrderedAuthors
Type: Text (1000)
Form control: Label
Default value: {% (if(firstauthor>0) { GlobalObjects.Users.Where("userid="+firstauthor)[0].UserName } else {""}) + ", " + (if(secondauthor>0) {GlobalObjects.Users.Where("userid="+secondauthor)[0].UserName} else {""} #%}
Depends on another field: true
I guess you have a list of authors somewhere in the database so you can just replace CMS_User table with your table. Then all you need to do is to adjust the macro in the third field to give you results you want.

How to set the "Ship To Select" shipping address dropdown field for a Sales Order?

When creating a Sales Order in NetSuite via Suitescript, we can successfully set the "Ship To" (Field ID: shipaddress) by sending it a string containing a full address.
This causes a problem because the "SHIP TO SELECT" dropdown field retains the default address set on the customer.
Ideally we would rather send in the valid ID from the Customer record and set the dropdown "SHIP TO SELECT" (Field ID: shipaddresslist) field using that ID.
We can get the valid ID, but cannot find a way to set that ID on the field in order to populate that dropdown.
Generally if you do this outside the context of a User Event Before Submit script you also need to make sure you save with sourcing.
var soRec = nlapiLoadRecord('salesorder' soId);
soRec.setFieldValue('shipaddresslist', addressId);
nlapiSubmitRecord(soRec, true);
// alternatively nlapiSubmitRecord(soRec, {enablesourcing:true [, disabletriggers:true|false, ignoremandatoryfields:true|false]});
If you are still seeing the old address text you might add:
soRec.setFieldValue('shipaddress', null);
before submitting.
If what you want to do is set a custom address then similar but you need to set the override:
var soRec = nlapiLoadRecord('salesorder' soId);
soRec.setFieldValue('shipaddresslist', null);
soRec.setFieldValue('shipoverride', 'T');
soRec.setFieldValue('shipaddress', formattedAddressString);
nlapiSubmitRecord(soRec);
Be warned though that doing this will make any searches or automation that rely on address fields miss or produce incorrect results around this record.
If you want a custom address you are generally better off:
var soRec = nlapiLoadRecord('salesorder' soId);
soRec.setFieldValue('shipaddresslist', null);
soRec.setFieldValue('shipaddr1', '123 Elm St.');
soRec.setFieldValue('shipcity', 'Portland');
...
nlapiSubmitRecord(soRec);

grocery crud add button to copy row in another table

I have 2 tables: customers and standby and I added a new button into my grocery crud in standby in that way:
$crud->add_action('Send', '', 'standby/copyrow','ui-icon-plus');
Both tables have the same fields, in standby I receive data from a form and the idea it's when I click "Send" copy that id ino customers and delete that id from standby
In other words I need to add a row from the first table (where I added a new button) into the second one, and then delete that row from the first table.
then I created a function
function copyrow($id)
{
// I don't know how can I add that row
}
Hope someone can help me, thanks in advance!
Tables that i used in this code:
First table name - customers
and Fields - a(primary key,auto increment), b
Second table name - standby
and Fields - c(primary key,auto increment), d
Make changes to your code that you want..
function copyrow($id)
{
$customers=$this->db->select('b')->where('a',$id)->get('customers')->result();
foreach ($customers as $customer)
{
$this->db->set('d', $customer->b);
$this->db->insert('standby');
$this->db->delete('customers', array('a' => $id));
}
}
I sure that you will help this code.

Resources