Hey everyone ! can anyone here help me , i have a record named "compte" that contain a field named " solde" and an other record named "transaction" that contian a field named "montant de transaction" i want that the solde field be updated awith the value " solde + transaction" how can i do this please
( i tried this in the create or update transaction page and it gives me error :
a!buttonWidget( saveInto: { a!save( target: ri!account['recordType!{b37748b2-8103-41ea-8028-2b358e4f229c}projet account.fields.{4a9de4b2-f127-44f1-86d2-21c2a6b2ee2d}Solde'], value: ( ifnull( if( ri!record['recordType!{ad2b45c4-cbc3-4de4-a189-c5593ad5032b}projet transaction.fields.{e57ce205-d18d-4eb2-83ee-f669e5c56ab1}somme'] >= 0, local!currentBalance + ri!record['recordType!{ad2b45c4-cbc3-4de4-a189-c5593ad5032b}projet transaction.fields.{e57ce205-d18d-4eb2-83ee-f669e5c56ab1}somme'], local!currentBalance + ri!record['recordType!{ad2b45c4-cbc3-4de4-a189-c5593ad5032b}projet transaction.fields.{e57ce205-d18d-4eb2-83ee-f669e5c56ab1}somme'] ), 0 ) ), ), }, label: if(ri!isUpdate, "Save", "Create"), submit: true, style: "SOLID", validate: true )
Discussion posts and replies are publicly visible
Is the above snippet resulting in an error? or is it just not giving the desired result?
this is the error :
a!buttonWidget( saveInto: { a!save( target: ri!account['recordType!{b37748b2-8103-41ea-8028-2b358e4f229c}.fields.{4a9de4b2-f127-44f1-86d2-21c2a6b2ee2d}'], value: ( if( and( a!isNotNullOrEmpty( ri!record['recordType!{ad2b45c4-cbc3-4de4-a189-c5593ad5032b}.fields.{e57ce205-d18d-4eb2-83ee-f669e5c56ab1}'] ), ri!record['recordType!{ad2b45c4-cbc3-4de4-a189-c5593ad5032b}.fields.{e57ce205-d18d-4eb2-83ee-f669e5c56ab1}'] >= 0 ), local!currentBalance + ri!record['recordType!{ad2b45c4-cbc3-4de4-a189-c5593ad5032b}.fields.{e57ce205-d18d-4eb2-83ee-f669e5c56ab1}'], 0 ), ), ), }, label: if(ri!isUpdate, "Save", "Create"), submit: true, style: "SOLID", validate: true )
It works if i do a test in the interface, thank you so much !
But in both the process model and on the site, it gives me the same problem. Could the problem be caused because I'm using the account as a rule input?
I also agree with Konduru if you are not 100% confident in those record fields and the local variable being a number I would also add type check those
It is hard to say without knowing all the details but the account being a rule input should not cause a problem if it is being set correctly.
in the interface the "solde" field is updated but i try it in the site it gives me an error
Can you attach the error message
the same error :
it's the same message error if i test the interface "create or update transaction" (that contain the save buttton) with a null ri!account that why i have asked if this could be the problem in the site
Yes that could be the problem I would think if that object is core to this page's functionality adding a null check earlier to display a error or not allow this update to occur would make most sense, but yes if that ri!account is null that would cause problems.
It works thank you ! the "solde" field in the data base doesn't change i think to do that i have to ad a write record in my "create or update transaction" Process Model and use an update even
Glad to help!