• Venkateswarlu Ch
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 0
    Replies
With the below snippet code we can do chatter from Apex or anonymous window 
ConnectApi.FeedElement feedElement = ConnectApi.ChatterFeeds.postFeedElement(Network.getNetworkId(), <sObjectId>, ConnectApi.FeedElementType.FeedItem, 'Hello chatter post 1');
 
I have put same snippet code in platform event after insert and published one record into object with Eventbus. publish(<platform event sObject>). Nothing is processing / no chatter post.
 
Could you please help me, can platform events support chatter API? if not, is there any workaround. Thank you!
In visualforce page I have a javascript for loop which calls a action function according to elements size

 
VF::

 <apex:form >
            <apex:actionFunction name="myActionFunction" action="{!actionFunctionMethod}"
                rerender="source,srcTable" oncomplete="">
            </apex:actionFunction>
    </apex:form>
<script>
       function addToList {
        for(var i=0; 1<ele.length; i++) {
            myActionFunction(); // This calls a method in contoller
        }
}
</script>

In controller I have a list initialised by its constructor and I add values by actionFunction as:

public with sharing class Details
{
  List<WrapperClass> detailsList {get; set;}

  public Details()
  {
     detailsList = new List<WrapperClass>();
  }

  public void actionFunctionMethod()
  {
    detailsList.add(new WrapperClass());
    System.debug('======  '+ detailsList.size()); // In system debug it is always 1
  }

  public class WrapperClass {

     public WrapperClass()
     {
     }
  }
}


Lets suppose the for loop execute myActionFunction 5 times. So, method actionFunctionMethod called 5 times and List must have size of 5. But it is always 1.

The Expected value for List should be 5 but actual coming value is 1. Context is same, page didn't reload but how this happening? and what should be work around it controller don't maintain values like this way?

I think some how list get initialised otherwise it will through null pointer exception. I have checked my code there is no initialisation except constructor.
we have 2 objects A [Field:code_A__c] & B [Field: Code_B___c]. whenever records insert or updates in B object with code_B___c, we query A object code_A__c & updates.
I want to bypass all Validation rules & WF rules in A object when the request from B object in Single Apex Transaction level for rest of all contexts it should execute all validations rules & WF Rules on A object
Tried options: custom Labels - Not fit >> user interaction required Custom Setting: More it's wide/profile/user based --> Not Apex Transaction based I'm thinking about creating a new field on A object & do track from flow B object, add in Validation rules & WF rules.
Any help/solution is appreciated.
I added a vf console component  footer area. We are using a 3rd party integration for CTI. I want to chek any call is Active on CTI softphone or not. I have written below code. But it gives every time Null value even the call is Active.  Could you please help me || what steps we can do to check that condition in VF pages?


<apex:page >
    <apex:includeScript value="/support/console/24.0/integration.js"/>
     <script type="text/javascript">

          var callback = function (result) {
              alert('Active call object ids: ' + result.ids);
          };
          
     </script>
     
<apex:form id="form"> 
    <apex:pageBlock id="thePageBlock" mode="edit"> 
   
    <apex:pageBlockButtons location="top"> 
    <apex:commandButton onClick="sforce.console.cti.getCallObjectIds(callback);" value="Active"/> 
    </apex:pageBlockButtons> 
    </apex:pageBlock> 
</apex:form>

</apex:page>

https://help.salesforce.com/apex/HTViewSolution?urlname=HTTPS-Security-Certificate-Switch-from-SHA-1-to-SHA-256-hash-algorithms&language=en_US

My Question is: How to do below 1st,2nd and 3rd steps ?

Please give me full description or any sample code.

any help is appreciated on this..
-------------------------------------------------------
To test the compatibility of an API client that uses SOAP to communicate with Salesforce:
1.  Set up an API client in a test environment.
 
2.  In that test environment, change the API client's login endpoint hostname from login.salesforce.com or [MyDomain].my.salesforce.com to sha2test.salesforce.com.
a.  As an example, change https://login.salesforce.com/services/Soap/u/32.0 to https://sha2test.salesforce.com/services/Soap/u/32.0 while leaving the path as-is.
 
3.  Log in with that API client.
 
4.  If you see an error message that resembles the following: "INVALID_LOGIN: Invalid username, password, security token; or user locked out." or “Content is not allowed in prolog.”, then this test passed and your integration can validate certificates with SHA-256 hash algorithms.
a.  The presence of this response means that the underlying TLS connection was successful, despite the higher-level error. The TLS connection is the focus of this test.
 
5.  If you instead see an error message that involves TLS or HTTPS, then the test has failed. Your API client will require adjustments or upgrades to operate properly with Salesforce, when Salesforce switches to the new certificates.

Thanks
I have two salesforce orgs A and B. I am want to get all Account records there in B org in Org A. I written code REST API. Eevrything workig fine. But how to user pass: /services/data/v29.0/queryAll/?q=SELECT+Name+from+Account. this use this funciton in REST API.

Below is my Code:

public class W_RestInvoke_Account2c{
    public String result{set;get;}
    fromJSON d1 {set;get;}
   // JSON2Apex d2            {set;get;}
    public String d3        {set;get;}     
    public String accesstkn {set;get;}     
    Account accrec          {set;get;}

public String clientid ;  

public void show(){

    Http p =new Http();
    HttpRequest request=new HttpRequest();
    request.setEndpoint('https://login.salesforce.com/services/oauth2/token');
    request.setMethod('POST');
    request.setBody('grant_type=password&client_id=tw&client_secret=7925616023235447130&username=cxxxm&password=xxx' );
    HttpResponse res=p.send(request);
    result=res.getBody();
  //string tknAccesstoken = (String) res.getAttribute(ACCESS_TOKEN); 

        d1 = (fromJSON)JSON.deserialize(result, fromJSON.class);
accesstkn = d1.access_token;
system.debug('VENKATESH______-->fromJSONvalues:Y'+ accesstkn );


HttpRequest request1= new HttpRequest();
request1.setEndpoint('https://ap1.salesforce.com/services/apexrest/RestAccount2');
request1.setMethod('GET');      
request1.setHeader('Authorization','OAuth '+accesstkn);
request1.setHeader('q','/services/data/v29.0/queryAll/?q=SELECT+Name+from+Account');
HttpResponse response=p.send(request1);
result= ''+response.getBody();

 

public class fromJSON{
public String id;   
public String issued_at;    
public String token_type;   
public String instance_url; 
public String signature;    
public String access_token; 

}
}


Pls help me where can use this /services/data/v29.0/queryAll/?q=SELECT+Name+from+Account function?

Hi All,
I have a post in chatter. For that post i m adding comment and file..
For that i have selected Attach file. After attachment file it directelly storing in content document and content version object. but the triggers not performing. when we click on cooment button the FeedComment, ContentVersion triggers firing.

Why it not firening when we clik on upload button?