Hi,
What could be the correct approach/steps to publish a post from a doctype on facebook.
For example, When user clicks on “Publish on Facebook” button in Item doctype, i want to publish an Item with photo and description based on various fields on Facebook post from ERPNext.
Thanks
Write the publish logic in your doctype controller. Then call it from client side using frm.call
class Post(Document):
...
def publish_to_facebook(self):
from facebook import publish # some facebook api package
publish(self.title, self.description)
...
Then in your form controller
frappe.ui.form.on("ToDo", {
onload: function(frm) {
frm.add_custom_button("Publish to Facebook", function() {
frm.call('publish_to_facebook');
});
},
}
1 Like