Hi
I have a modeldriven app used as a crm, occasionally when inputting data directly via the crm the app removes the account data upon saving.
I have created a canvas app to embed into an intranet however when saving the data from the app this constantly removes the account information leaving the information as detailed above.
As you can see from the image above the data is gathered correctly but when I click save it removes the account data causing the flow to fail.
The code used is detailed below
If(
(lvarCrrStg = 4 And CountRows(
Filter(
collPrgStages,
StatusFlag = 2
)
) =3),
Patch(Projects,
Defaults(Projects),
{
'🛠️ Project Name':projectname.Text,
'Job Cost Limit':Value( costs.Text),
'📅 Start Date': 'start date'.SelectedDate,
'📅 Dead Line': deadlinedate.SelectedDate,
'Urgent Request': urgentreq.Selected.Value,
'Is CIS ?': iscis.Selected.Value,
'⚙️ Project Category': category.Selected,
'🏢 Property': property.Selected,
'🏢 Account': Gallery3.Selected,
'👤 Project Contact': Gallery4.Selected,
'Employee (crffc_Employee)': Gallery3_1.Selected,
Contractor: Gallery4_1.Selected,
'📋 Description': projdesc.Text
})
;
Notify("Project details submitted successfully!", NotificationType.Success);
UpdateContext({lvarSubmitted: true})
);
If(
lvarCrrStg=3,
If(
IsBlank(projectname.Text),
UpdateContext({lvarprojectnameEmpty:true}),
UpdateContext({lvarprojectnameEmpty:false})
);
If(
IsBlank(costs.Text),
UpdateContext({lvarcostsEmpty:true}),
UpdateContext({lvarcostsEmpty:false})
);
If(
IsBlank(projdesc.Text),
UpdateContext({lvarprojdescEmpty:true}),
UpdateContext({lvarprojdescEmpty:false})
);
If(
IsBlank(projacclabel.Text),
UpdateContext({lvarprojacclabelEmpty:true}),
UpdateContext({lvarprojacclabelEmpty:false})
);
If(
IsBlank(projcontlabel.Text),
UpdateContext({lvarprojcontlabelEmpty:true}),
UpdateContext({lvarprojcontlabelEmpty:false})
);
If(
IsBlank(Gallery3.Selected),
UpdateContext({lvarGallery3Empty:true}),
UpdateContext({lvarGallery3Empty:false})
);
If(
IsBlank(Gallery4.Selected),
UpdateContext({lvarGallery4Empty:true}),
UpdateContext({lvarGallery4Empty:false})
);
If(
IsBlank(emplabel.Text),
UpdateContext({lvaremplabelEmpty:true}),
UpdateContext({lvaremplabelEmpty:false})
);
If(
IsBlank(projdesc.Text),
UpdateContext({lvaremplabelEmpty:true}),
UpdateContext({lvaremplabelEmpty:false})
);
If(
lvarprojectnameEmpty || lvarcostsEmpty || lvarprojdescEmpty || lvarprojacclabelEmpty || lvarprojcontlabelEmpty || lvarGallery3Empty || lvarGallery4Empty || lvaremplabelEmpty || lvarprojdescEmpty,
Patch(
collPrgStages,
LookUp(
collPrgStages,
ID = lvarCrrStg
),
{
StatusFlag: 0,
IsCrrStage: false
}
);
Patch(
collPrgStages,
LookUp(
collPrgStages,
ID = lvarCrrStg + 1
),
{IsCrrStage: true}
),
Patch(
collPrgStages,
LookUp(
collPrgStages,
ID = lvarCrrStg
),
{
StatusFlag: 2,
IsCrrStage: false
}
);
Patch(
collPrgStages,
LookUp(
collPrgStages,
ID = lvarCrrStg + 1
),
{IsCrrStage: true}
)
)
);
UpdateContext(
{
lvarCrrStg: If(
lvarCrrStg + 1 <= CountRows(collPrgStages),
lvarCrrStg + 1,
4
)
}
)
also i have two galleries one with the accounts in and another with related contacts - the issue with this is the accounts show fine but only a few accounts will show the related contacts with others showing as blank (image below)
without contact
with contact
the code for the gallery filter is
Filter(Contacts, AsType('Company Name',[@Accounts]).'🏢 Account Name' = Gallery3.Selected.'🏢 Account Name')
with this information, i was hoping you gurus out there would be able to point me in the right direction to where i am going wrong 😄
thank you in advance
In your code that validation is after the patch, or am I reading it wrong?
This is the whole patch code
If(
(lvarCrrStg = 4 And CountRows(
Filter(
collPrgStages,
StatusFlag = 2
)
) =3),
Patch(Projects,
Defaults(Projects),
{
'
️ Project Name':projectname.Text,
'Job Cost Limit':Value( costs.Text),
'
Start Date': 'start date'.SelectedDate,
'
Dead Line': deadlinedate.SelectedDate,
'Urgent Request': urgentreq.Selected.Value,
'Is CIS ?': iscis.Selected.Value,
'
Project Category': category.Selected,
'
Property': property.Selected,
'
Account': Gallery3.Selected,
'
Project Contact': Gallery4.Selected,
'Employee (crffc_Employee)': Gallery3_1.Selected,
Contractor: Gallery4_1.Selected,
'
Description': projdesc.Text
})
;
Notify("Project details submitted successfully!", NotificationType.Success);
UpdateContext({lvarSubmitted: true})
);
as you see it will only patch if lvarstg has reached 4 and there are no blanks
the issue does not seem to lie with the patch because all other details submit perfectly fine - the issue seems to be for some reason the model-driven app keeps removing the account record upon submission
So I have swapped a few things around to enable adding in contacts however, I decided to try using a form,
preset form
model driven app after form submission - still missing account details
to add in the accounts via a preset dropdown and still get the same issue with a form as I do with the custom fields. This is getting really confusing 😕 does anyone have any ideas about what may be going wrong?
Are you sure you have no workflow running on these records or something of that sort.
IF you a look at a brand new record, what do the dates tell you? Look at created on and modified on
There's got to be something going on.
the only flow is to auto send an email to the account contact and employee when the data is added - because the account data doesn't fill, the flow to the account contact fails (relies on the account field being filled) but the email to the employee completes no issues
the account email fails with : The 'inputs.parameters' of workflow operation 'Get_a_row_by_ID' of type 'OpenApiConnection' is not valid. Error details: The resolved string values for the following parameters are invalid, they may not be null or empty: 'recordId' this is because it is not populating the account field
created and modified dates are set to the same date and time
on checking the monitor it appears everything is running successfully yet still no population of the account field
after checking the formula in the monitor it shows the account as null