Via PowerAutomate you can use run action triggered by a button in Powerapps this is the code I used for the patch
Set(vDocument, DataCardValue70_1.Text);
If(
Trim(vRespNumber) = "",
IfError(
UpdateContext(
{
respuesta: Patch(
'salesQuotes (v2.0)_1',
Defaults('salesQuotes (v2.0)_1'),
{
'Customer No.': ComboBoxCustomer_1.Selected.'No.',
'External Document No.': DataCardValue70_1.Text,
Salesperson: ComboBoxVendedor_1.Selected.'Código del vendedor'
}
)
}
),
Set(
vRespId,
respuesta.Id
),
Set(
vRespNumber,
respuesta.'No.'
),
Notify(FirstError.Message)
)
);
Set(
vRespId,
LookUp(
'salesQuotes (v2.0)_1',
'No.' = vRespNumber
).Id
);
IfError(
UpdateContext(
{
respuestaDet: Patch(
'salesQuoteLines (v2.0)_1',
Defaults('salesQuoteLines (v2.0)_1'),
{
Sequence: gNumLinea,
//'Item Id':Items.Selected.Id,
'Item Id': ComboBoxItems_1.Selected.Id,
'Document Id': vRespId,
Quantity: vQty
}
)
}
),
Notify(FirstError.Message)
);
Set(
gNumLinea,
gNumLinea + 10000
);
After that i used a powerautomate flow to do the Sales Invoice with the run action and a second flow for the Posted Sales Invoice