powerautomate - check empty field condition - power-automate

I am doing approval flow with powerautomate.
some of my approval processes don't need 1st level (manager) approval.
so I want to do it by not filling in the manager name when I add new item.
-if the manager name is empty field found in Sharepoint list, > update the item with "manager null" in approval history column.
the following screenshot is my flow. but it didn't not update the item if the manager column is empty.
only working if the manager file has value, and it update the item.
how can I achieve the empty field check.?

I assume your Manager field allows multiple values and is of type person or group. This is because I see you have an apply to each loop.
I would remove the apply to each and simply check the length of the Manager field itself, not one of its properties like displayName,etc (that will add the loop).
Below is an example.
In the condition I used this expression. Add that via the expression editor:
length(triggerOutputs()?['body/Manager'])

Related

Mendix Retrieve last input value

In mendix i have 2 pages: Course Overview and Course_newEdit.
As the names suggest overview i the overview page and the second one is edit page.
The entity name is Course.
Its attributes are: Name String and Description String.
I have a requirement that i when a user edits course, the default value for name should be the last user input value.
So if the user has give first course name as History.
The second time any user tries to input the name, it should by default show History.
how can this be achieved?
I couldn't find any option for the same in the default settings.
Mendix 9.2 pro
If you are editing an existing course than it will automatically show the value that was last stored in the database so you don't need to do anything there.
If you are creating new course and want the default value of 'Name' attribute to be automatically filled in using the previous course object, than you have to retrieve last saved course object from database with range option = 'First' and add sort property that can identify the retrieve object as last saved course object. Than you can use retrieved last saved course and copy 'Name' to your new course object.
Please check out Mendix Forum and Mendix Slack Community if you have more questions.
Mendix Forum: https://forum.mendix.com
Community Slack: https://join.slack.com/t/mendixcommunity/shared_invite/zt-hwhwkcxu-~59ywyjqHlUHXmrw5heqpQ
first you need to retrieve the list "Course" from database then sort the list by creating date descending then retrieve head of the new sorted list then fill this object in the new created one
course/name

Batch change of field value in Mailchimp

For a charity, I've set up a mailing list with some customised fields. One of these fields has a default value, and updated values for individual subscribers. However, I now have to reset the field for all subscribers to a new default value, and this will need to be done again on a yearly basis.
The only way I found to do this so far is to delete the field and recreate it with the new default value. But this is very sensitive to errors when I transfer the management to other volunteers.
Is there an easier way to achieve a field value reset in Mailchimp?
In addition, I'm looking to update a field value for a subset of subscribers in batch. If possible, the solution applies to this problem as well.
Thanks, Juul.
You can export the contacts list following these steps:
https://mailchimp.com/en/help/view-or-export-a-list/
Then make the changes you need in the exported list.
Finally, import it again checking the field "Update existing contacts":
https://mailchimp.com/help/import-contacts-mailchimp

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.

Determine new record in PreWriteRecord event handler and check value of joined field

There is custom field "Lock Flag" in Account BC, namely in S_ORG_EXT_X table. This field is made available in Opportunity BC using join to above table. The join specification is as follows: Opportunity.Account Id = Account.Id. Account Id is always populated when creating new opportunity. The requirement is that for newly created records in Opportunity BC if "Lock Flag" is equal to 'Y', then we should not allow to create the record and we should show custom error message.
My initial proposal was to use a Runtime Event that is calling Data Validation Manager business service where validation rule is evaluated and error message shown. Assuming that we have to decide whether to write record or not, the logic should be placed in PreWriteRecord event handler as long as WriteRecord have row already commited to database.
The main problem was how to determine if it is new record or updated one. We have WriteRecordNew and WriteRecordUpdated runtime events but they are fired after record is actually written so it doesn't prevent user from saving record. My next approach was to use eScript: write custom code in BusComp_PreWriteRecord server script and call BC's method IsNewRecordPending to determine if it is new record, then check the flag and show error message if needed.
But unfortunately I am faced with another problem. That joined field "Lock Flag" is not populated for newly created opportunity records. Remember we are talking about BC Opportunity and field is placed in S_ORG_EXT_X table. When we create new opportunity we pick account that it belongs to. So it reproduceable: OpportunityBC.GetFieldValue("Lock Flag") returns null for newly created record and returns correct value for the records that was saved previously. For newly created opportunities we have to re-query BC to see "Lock Flag" populated. I have found several documents including Oracle's recomendation to use PreDefaultValue property if we want to display joined field value immediately after record creation. The most suitable expression that I've found was Parent: BCName.FieldName but it is not the case, because active BO is Opportunity and Opportunity BC is the primary one.
Thanks for your patience if you read up to here and finally come my questions:
Is there any way to handle PreWrite event and determine if it is new record or not, without using eScript and BC.IsNewRecordPending method?
How to get value of joined field for newly created record especially in PreWriteRecord event handler?
It is Siebel 8.1
UPDATE: I have found an answer for the first part of my question. Now it seems so simple to me that I am wondering how I haven't done it initially. Here is the solution.
Create Runtime Event triggered on PreWriteRecord. Specify call to Data Validation Manager business service.
In DVM create a ruleset and a rule where condition is
NOT(BCHasRows("Opportunity", "Opportunity", "[Id]='"+[Id]+"'", "AllView"))
That's it. We are searching for record wth the same Row Id. If it is new record there should't be anything in database yet (remember that we are in PreWriteRecord handler) and function returns FALSE. If we are updating some row then we get TRUE. Reversing result with NOT we make DVM raise an error for new records.
As for second part of my question credits goes to #RanjithR who proposed to use PickMap to populate joined field (see below). I have checked that method and it works fine at least when you have appropriate PickMap.
We Siebel developers have used scripting to correctly determine if record is new. One non scripting way you could try is to use RuntimeEvents to set a profileattribute during the BusComp NewRecord event, then check that in the PreWrite event to see if the record is new. However, there is always a chance that user might undo a record, those scenarios are tricky.
Another option, try invokine the BC Method:IsNewRecordPending from RunTime event. I havent tried this.
For the second part of the query, I think you could easily solve your problem using a PickMap.
On Opportunity BC, when your pick Account, just add one more pickmap to pick the Locked flag from Account and set it to the corresponding field on Opportunity BC. When the user picks the Account, he will also pick the lock flag, and your script will work in PreWriteRecord.
May I suggest another solution, again, I haven't tried it.
When new records are created, the field ModificationNumber will be set to 0. Every time you modify it, the ModificationNumber will increment by 1.
Set a DataValidationManager ruleset, trigger it from PreSetFieldValue event of Account field on Opportunity BC. Check for the LockFlag = Y AND (ModificationNumber IS NULL OR ModificationNumber = 0)) and throw error. DVM should throw error when new records are created.
Again, best practices say don't use the ModNumbers. You could set a ProfileAttribute to signal NewRecord, then use that attribute in the DVM. But please remember to clear the value of ProfileAttribute in WriteRecord and UndoRecord.
Let us know how it went !

CRM 4 Add Picklist Value

I would like to create a possible value for a specific picklist on CRM4.
I can see that the possible values are located in the stringmap table. My question is about how to properly add another record. The objecttypecode (10063) and attributename (assessmenttype) already exist - I simply need to add a new option to the picklist.
Of course, not wanting to void our support, I cannot just add the record to the table.
I have exported the xml configuration of this entity, and I can see the picklist values in this file under the "options" node of the picklist attribute node. I have imported this customization but it clearly is not all that needs to be done - my new values are neither in the stringmap table or visible on the form. what else needs to be done?
You need to use the metadata web service to make these updates. Check out http://technet.microsoft.com/en-us/library/dd904037.aspx for a walkthrough of how to create picklists. You'll also want to look at the UpdateAttributeRequest class.

Resources