I am using ribbon workbench and I need my customize button to activate two functions :
When I click my button the js function works but nothing is saved and I get a massage that my data is not saved, it seems that the crm function: Mscrm.SavePrimary, was fired but wasn't complete.
Is connecting these two functions to one button is possible? If it's possible what is the right way?
The right way would be to use the Save function that is in SDK: https://msdn.microsoft.com/pl-pl/library/gg334720.aspx#Anchor_8
Xrm.Page.data.entity.save()
is equivalent of "Save" command that you have on command bar. What are you currently doing is not supported customization and is likely to stop working after any upgrade of the system
For people using Dynamics 365 Online version 9.x and later, save function is changed a little bit: https://learn.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data/save
formContext.data.save(saveOptions).then(successCallback, errorCallback);