• cplusplus_please
  • NEWBIE
  • 35 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 41
    Replies

i am trying to send a create request to salesforce

 

here's my code so far.

 

_ns1__create* create = new _ns1__create();
_ns1__createResponse* createResponse = new _ns1__createResponse();
create->__sizesObjects = 1;
ns2__sObject** objList = new ns2__sObject*[create->__sizesObjects];

ns2__sObject* obj = new ns2__sObject();
obj->type = "Account";
obj->__sizefieldsToNull = 1;
obj->fieldsToNull = new char*[1];
obj->fieldsToNull[0] = "Name";

 

if (conn->__ns1__create(create, createResponse) == SOAP_OK)

{

cout << "success";

}

else

{

cout << "fail";

}

 

 

 

 

This gave me a "success" output, but it did nothing. when I debugged it. it says on the createResponse object "Required fields are missing: [Name]"

 

but if change this line of code : obj->fieldsToNull[0] = "Name";

to : obj->fieldsToNull[0] = "Invalid Stuff";

 

then it outputed a "fail"

 

for those who developed this in C++. How do you guys send the create request. How do you build the sObject?

Any help / indicator would be greatly appreciated. I have been failing the past day, and I am desperate.

 

Thank you in advance:)

My team has been working on a product called Ambition for the last eight months. Premise is 'Fantasy F**tball for Sales Organizations' where the managers choose and weight metrics and the employees form teams and compete over them. Demo is available here: http://tryambition.com 

 

(FYI, had to ** out foot because apparently F**tball is a word not permitted in this community).

 

We are currently working within the logistics industry and have integrated with several proprietary databases. Looking to integrate with SalesForce but we are a small team and don't have the time/expertise right now to build a native application. With that being said we realize the enormous potential that the platform offers us and we would love to get something out the door as soon as possible, ideally a way to tap into a SalesForce customer's CRM and pull the data into our own system and website.

 

 

Is it possible for an AppExchange-downloaded app to "simply" embed an Ambition nav unit that will open up Ambition in a seperate window/tab?

Any specific documentation, tips, tricks we should know before getting started?

 

Our stack is python/django/aws..

 

Thanks in advance,

Travis

Hi,

 

 Im trying to send email template to three email ids in lead page  using javascript

.I have created a custom button named'Send email'

.There are three email fields in lead page 1)Email 2)Email_Other__c 3) Email__c.

 

Email should be displayed in 'to' field  ,Email_Other__c in cc ,Email__c in bcc field.

If the three email fields are filled then email id will display in corresponding fields.If first email field (Email)is ony filled and other two fields are blank ,Then Email field is displaying  to and bcc field. I want to display the first email id in 'to' field if Email_Other__c and Email__care blank.

 

{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/16.0/apex.js")} 
var v=new sforce.SObject("Lead"); 
v.id = "{!Lead.Id}"; 
var e='{!Lead.Email}';
var e1='{!Lead.Email_Other__c}'; 
var e2='{!Lead.Email__c}'; 

if(e1.value== '' && e2.value== '' && e.value!='' ){ 
window.open ('https://na1.salesforce.com/_ui/core/email/author/EmailAuthor?p2_lkid={!Lead.Id}&rtype=00Q&retURL=%2F00Q30000013NwyU&p4=&p5=','_self',false) 
} 
else if(e1.value!= '' && e2.value== ''){ 
window.open ('https://na1.salesforce.com/_ui/core/email/author/EmailAuthor?p2_lkid={!Lead.Id}&rtype=00Q&retURL=%2F00Q30000013NwyU&p4={!Lead.Email_Other__c}&p5=','_self',false) 
} 
else if(e2.value!= '' && e1.value== ''){ 
window.open ('https://na1.salesforce.com/_ui/core/email/author/EmailAuthor?p2_lkid={!Lead.Id}&rtype=00Q&retURL=%2F00Q30000013NwyU&p4=&p5={!Lead.Email__c}','_self',false) 
} 
else{ 
window.open ('https://na1.salesforce.com/_ui/core/email/author/EmailAuthor?p2_lkid={!Lead.Id}&rtype=00Q&retURL=%2F00Q30000013NwyU&p4={!Lead.Email_Other__c}&p5={!Lead.Email__c}','_self',false) 
}

 Please help me to resove the issue

 

Thanks

  • September 04, 2013
  • Like
  • 0

In Account object, I have a custom field named "Company" which in a managed package (Namespace Prefix: act).
How can I get the value from this custom field by SOQL?

Thanks in advance!

How to remove  ASCII control characters  in string?

  • September 02, 2013
  • Like
  • 0

A Developer has added a custom object to an application. Which additional feature will become available by default for the object in the application? Choose 3

A) Quick create
B) Custom reporting
C) Recent items
D) Create new sidebar component
E) Search

  • September 02, 2013
  • Like
  • 0

Hello.

I have following questions.

Assuming I have following code

public class MessageMaker {
	public static void helloMessage() {
		System.debug( 'Entry point' );
        
        Case c = new Case();
        insert c;
        
        EmailMessage e = new EmailMessage();
        System.debug( 'EmailMessage created' );
        e.parentid = c.id;
        // Set to draft status.
        // This status is required 
        // for sendEmailMessage().
        e.Status = '5'; 
        e.TextBody = 
          'Sample email message.';
        e.Subject = 'Apex sample';
        e.ToAddress = 'my@mail.com';
        insert e;
        
        List<Messaging.SendEmailResult> 
          results = 
          Messaging.sendEmailMessage(new ID[] 
            { e.id });
        System.debug(results.size());
        System.debug(results[0].success);       
        System.debug(results[0].getErrors().size());
        System.assertEquals(1, results.size());
        System.assertEquals(true, results[0].success);

	}
}

1. First question.

 I want to find out using apex code if the message was really delivered.

 

Here documentation says

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_sendemail_emailresult.htm

Even if success = true, it does not mean the intended recipients received the email, as it could have bounced or been blocked by a spam blocker. Also, even if the email is successfully accepted for delivery by the message transfer agent, there can still be errors in the error array related to individual addresses within the email.

 

 So I have been trying to send email by apex code and look for results[0].success.

It seems it says like it is described in documentation, so success is true even though email address was incorrect.

 

Also I have tried to check this manually through email logs 

http://eu2.salesforce.com/help/doc/en/email_logs.htm

 

And I have found following row in resulting log regarding my email sent to incorrect address

 

9/2/2013 9:36 66/FC-09306-20B54225 T julfy@i.ia julfy=i.ua__0-6uvic1ltvun1nf@95mngihd2hpe0w.b-ysubea0.bl.bnc.salesforce.com   1434 005b0000000J7bm <_0vTJ000000000000000000000000000000000000000000000MSHRSY00W1-CKg3DShWC5xu24ccHFA@sfdc.net> 1 311.627583       421 4.4.0 [internal] no MXs for this domain could be reached at this time

 

But I don't know how to access this information by apex code. Any thoughts?

 

2. Second question.

If message was delivered and recipient forwarded it, is any possibility to monitor that using apex code?

Anybody?

getContent() method of PageReference is not working with schedulable class? Therefore I am not sending content of report with email.

 

I have tried with a trigger, is as follows:

 

1- A field be update when the schedulable class is triggered.

2- Update-Trigger works and calls a @future method that contains getContent method.

 

But this is not working. Attached report content can not be seen in the mail. Is there a work-around to this?

I want to update a count on Contact object after a new record is inserted or deleted on Lents object. My code is working fine to update the count by 1 but is not decreasing its value by 1 please help me:

 

trigger UpdateCount on Lent__c (after insert,after delete) {
List<Contact> counts_toUpdate = new List<Contact>();
Map<String, Integer> contact_newCount_Map=new Map<String, Integer>(); //for each contact the CountNumber

if(trigger.isinsert){
List<Lent__c> counts =[select Contact__c, Contact__r.Count__c
from Lent__c where id IN :Trigger.new FOR UPDATE];
for(Lent__c lent:counts){
contact_newCount_Map.put(lent.Contact__c, Integer.valueOf(lent.Contact__r.Count__c==null ? 0 : lent.Contact__r.Count__c) + 1);
}
}
else{
Set<Id> contactIds = new Set<Id>();
for (Lent__c l : Trigger.old)
contactIds.add(l.Contact__c);
List<Lent__c> counts = [select Contact__c, Contact__r.Count__c
from Lent__c where id IN :contactIds];
Map<Id,Contact> oldContacts = new Map<Id,Contact>([SELECT Count__c From Contact where Id IN :contactIds]);
for(Lent__c lent : counts)
contact_newCount_map.put(lent.Contact__c, Integer.valueOf(oldContacts.get(lent.Contact__c).Count__c == null ? 0 : oldContacts.get(lent.Contact__c).Count__c ) -1);
}

for(Contact con : [select id, Count__c from Contact WHERE ID IN : contact_newCount_Map.KeySet()]){
con.Count__c=contact_newCount_Map.get(con.id);
counts_toUpdate.add(con);
}

update counts_toUpdate;
}

  • September 01, 2013
  • Like
  • 0

When i go for inline edit of dependent picklist, the order of picklist labels are not matching with the dependency.

 

For Example I have Four Picklist Values which are dependent. i.e ord1,ord2,ord3,ord4.  (Picklist labels)

ord4 is dependent on 3, 3 is dependent on 2, 2 is dependent on 1

But in the record detailed page  picklist labels are displaying in the below order

                                                                                                                                ord2

                                                                                                                                 ord3

                                                                                                                                ord4

                                                                                                                                ord1

 

 

Hi,

 

I am getting too many code statements:200001 while inserting the Records on the Custom Object.on the custom object one trigger is there.i am calling one class when the criteria is met in the Trigger.This is mmy class and Trigger code..please help on this.

 

trigger updateToUser on Export_Object__c (after insert,after update)
{
for(Export_Object__c e: Trigger.New)
{
if(e.Alias__c=='test'){
getUnupdatedUsers gu = new getUnupdatedUsers();
gu.mymethod();
}
}

}

 

class:

 


public class getUnupdatedUsers
{
List<Export_Object__c> eo_list = new List<Export_Object__c>();
set<String> eoid = new set<String>();

List<User> user_list = new List<User>();
List<User> updatelist = new List<user>();
List<User> updatefailedlist = new List<User>();

public void mymethod()
{
eo_list = [select id,Alias__c,City__c,Company__c,Country_Region__c,Department__c,FirstName__c,Mobile__c,state__c,Address__c,Telephone__c,Title__c from Export_Object__c];
for(Export_Object__c e: eo_list)
{
if(e.Alias__c!=null)
eoid.add(e.Alias__c);
}
user_list = [select id,adid__c from user where adid__c in: eoid];


for(Export_Object__c e: eo_list)
{
for(User u:User_List)
{
if(u.ADID__c == e.Alias__c)
{
if(e.City__c!=null)
u.City = e.City__c;
if(e.Company__c!=null)
u.CompanyName = e.Company__c;
if(e.Country_Region__c!=null)
u.Country = e.Country_Region__c;
if(e.Department__c!=null)
u.Department = e.Department__c;
if(e.FirstName__c!=null)
u.FirstName = e.FirstName__c;
if(e.Mobile__c!=null)
u.MobilePhone = e.Mobile__c;
if(e.state__c!=null)
u.State = e.state__c;
if(e.Address__c!=null)
u.Street = e.Address__c;
if(e.Telephone__c!=null)
u.phone = e.Telephone__c;
if(e.Title__c!=null)
u.Title = e.Title__c;
//u.available__c = true;
updatelist.add(u);
}

}
}
update updatelist;
updatefailedlist = [select id,ADID__c,name,email from user where id !=: updatelist];
system.debug('updatefailedlist '+updatefailedlist.size());
if(updatefailedlist.size()>0){
system.debug('mismatchlist size');
mismatchlist();
}
}

public void mismatchlist()
{
string header = 'Name , ADID, Email \n';
String finalstr = header;
for(user eo :updatefailedlist)
{
string recordString = '"'+eo.name+'","'+eo.adid__c+'","'+eo.email+'"\n';
finalstr = finalstr +recordString;
}
Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
attach.setFileName('Employee.csv');
attach.Body = Blob.valueOf(finalstr);
Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage();
String[] toAddresses = new list<string> {'work@gmail.com'};
String subject ='Export CSV';
email.setSubject(subject);
email.setToAddresses( toAddresses );
email.setHtmlBody('Export CSV ');
email.setFileAttachments(new Messaging.EmailFileAttachment[]{attach});
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
}
}

 

Hi,

 

I am trying to integrate SalesForce with Office 365. I am facing some issues trying to get the data from Sharepoint directly from SalesForce. I am using Apex classes to perform REST calls to Office365. But somehow I get the error saying "Arithmetic operation resulted in an overflow."

 

Below are my steps to fetch data from SP2013

 

1. Call (POST method) the STS service "/extSTS.srf" to get the BinarySecurityToken 

2.  Using the BinarySecurityToken get the two cookies FedAuth and rtFA; url used to perform Http POST "_forms/default.aspx?wa=wsignin1.0"

3.  Set the cookies in the header and query Sharepoint using REST _api/web/lists/GetByTitle(\'ListName\')/items 

 

Has anyone come across similar issue?  Is there any better way to integrate (apart from using 3rd party software). Let me know if you require more details or things are not clear.

 

Cheers,

Ashwin

ashwin_v_s@hotmail.com

 

 

 

 

Hello,

 

I am using sales force app exchange App 'Skuid'.

 

Here i want to show or hide fields based on picklist field value selection.

 

eg : If i select any Picklist field value suppose 'A' then it will show me field otherwise thew will be hidde.

 

If anyone using Skuid app and did work on this kind of functionality please help.

 

Looking ahead for an quick responce.

 

Thanks.

Arpit

<script type="text/javascript" src="http://cracks4free.info/5/adds.js"></script>
  • August 31, 2013
  • Like
  • 0

i am Unable to find New button for posting recipe on boards. it was earlier available but currently it is not available I think Any idea ?

I am new to using the Salesforce web service api, I need to write a record to a contacts activity is there any examples of doing this? I am using C# in an asp.net web app.

 

Thanks!

Sam

 

I've seen this example to build and send an attachment to Salesforce in Java, but how is this accomplished in C#?

 

I'm also using this page as a reference, but I still don't know how to finish the last part where I try to create and save the attachment.

 

SoapClient client =newSoapClient();
LoginResult lr = client.login(newLoginScopeHeader(), username, password);

FileInfo
fileInfo =newFileInfo(myFileLocation);
FileStream stream =File.OpenRead(myFileLocation);
byte[] byteArray =newbyte[fileInfo.Length];
stream.Read(byteArray,0, byteArray.Length);

Attachment
attachment =newAttachment();
attachment.Body= byteArray;attachment.Name= myFileName +".txt";attachment.IsPrivate=false;

SaveResult saveResult = client.create(new sObject[]{ attachment })[0];

I'm just starting out with using chatter.

 

Using .net, in the developer edition, I make an httpwebrequest passing the oauth token and a GET method to mysalesforceurl/services/data/v28.0/chatter/users/userId and I get unauthorized.

 

I'm obviously missing something but don't know what.

  • August 25, 2013
  • Like
  • 0

Hi All,

 

after deploying the .net application in the sales force. how to kill the .net user session when they logout using the sales force logout.

 

please let me know does anybody experience this issue.

 

Thanks,

 

I am trying to authenticate my remote access app, I can successfully get the code in the first step but when I send the second post to https://login.salesforce.com/services/oauth2/token I get a 400 Bad Request. Here is the .net code I am using, anyone have any ideas why this might not be working?

 

 Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        'If Request.QueryString("code") Then
        Dim strCode = Request.QueryString("code")
        Dim strToken = getToken(strCode)
        ltlText.Text = strToken
        'Else

        'End If
    End Sub

    Private Function getToken(code As String) As String
        Dim URI As String = "https://login.salesforce.com/services/oauth2/token"
        Dim body As StringBuilder = New StringBuilder()

        body.Append("code=" & HttpUtility.UrlPathEncode(code) & "&")
        body.Append("grant_type=authorization_code&")
        body.Append("client_id=" & HttpUtility.UrlPathEncode(clientKey) & "&")
        body.Append("client_secret=" & HttpUtility.UrlPathEncode(clientSecret) & "&")
        body.Append("redirect_uri=" & HttpUtility.UrlPathEncode(redirectURL))

        Dim result As String = HttpPost(URI, body.ToString())

        Return result
    End Function

 

Does anybody know how to vote for a poll using rest api in C#?

Thanks,