We can post a chatter on any object with the help of the Apex class.
we can inject this code in my apex class and create a post
FeedItem post = new FeedItem();
post.ParentId = objecct Id; // id of any object
post.Body = 'This is my first post on chatter'; // body of the post
insert post;
========================================================================
Toast message using Java script
<apex:page lightningStylesheets="true">
<script>
function showToast() {
sforce.one.showToast({
"title": "Success!",
"message": "Welcome to salesforce code crack.",
"type": "success"
});
}
</script>
<apex:form >
<apex:page >
<apex:commandButton value="Show Toast" onclick="showToast();" />
</apex:page>
</apex:form>
</apex:page>
we can inject this code in my apex class and create a post
FeedItem post = new FeedItem();
post.ParentId = objecct Id; // id of any object
post.Body = 'This is my first post on chatter'; // body of the post
insert post;
========================================================================
Toast message using Java script
<apex:page lightningStylesheets="true">
<script>
function showToast() {
sforce.one.showToast({
"title": "Success!",
"message": "Welcome to salesforce code crack.",
"type": "success"
});
}
</script>
<apex:form >
<apex:page >
<apex:commandButton value="Show Toast" onclick="showToast();" />
</apex:page>
</apex:form>
</apex:page>
No comments:
Post a Comment