• Rohit Tripathi
  • NEWBIE
  • 80 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 13
    Replies
Hi All,

I am doing Hybrid Mobile App Development using Xcode and I am trying to populate data in Sample SOUP. Code in my index.html file is as :

Register Soup :

function registerSoup(){
                        var soupName = "SOUP_1";
                        var indexSpecs = [
                                          {path:"Id",type:"string"},
                                          {path:"Name",type:"string"},
                                          ];
                                          sfSmartstore().registerSoup(soupName, indexSpecs, successCallback, errorCallback);
                    }

Populating Soup :

function createRecords(){
                    var dummyRecords = [{
                    "Name": "My Dummy Record",
                    "Id": "123456789012345678",
                    "Something": "Nothing"
                    },{
                    "Name": "Another Record",
                    "Id": "876543210987654321",
                    "Something": "Something Else"
                    }];
                    smartstore.upsertSoupEntriesWithExternalId("SOUP_1",dummyRecords, "Id", function(){
                                   alert("Upsert Success");},
                                   function(error){
                                        alert("onErrorUpsert using force.query : " + error);
                                         });
                        
            }

After running this code in simulator, it is either not showing any output or alerting "onErrorUpsert using force.query : null". It is not upserting data in SOUP. 
I am not sure what is wrong. Can you please help. 
Hi All,

I created a class which selects live sessions from AuthSession object filtering on the basis of createddatetime and terminate those sessions. When I created test class, I am not able to write any data in AuthSession object. Any idea or way to populate some data in AuthSession object and create some sessions with different createddatetime. 

Any help is greatly appreciated. 
Hi Everyone,

I am adding a custom button on standard detail page. When user clicks on this custom button, javascript code is executed and if condition is met, a new tab opens up with data from another object. When condition is not met, it is currently coded to diplay standard javascript alert window. I want to disable the custom button on Standard detail page if condition is not met. I am ok if button is disabled after user clicks on button once. I am trying to achieve this by using document.getElementById("Id of Button") method but I am not able to find out what should be the Id of custom button. 

If there is some other way to achieve this then I would like to know, otherwise if there is a way to get Id of custom button then I can try to implement it using document.getElementById("Id of Button") method. 
Hi,

I want to create duplicate copy of an object in Salesforce since we need to archive some data into duplicate object. Is there a better way to do this without using third part app from app exchange. I tried it using Force.com IDE but it is getting errored out while saving to server. 
Hi,

I have to archive some data from Related Objects. Objects are related like :

Scenario 1 :    Obj A (Parent of) --------------->  Obj B
Scenario 2 :     Obj A (Look Up) ----------------> Obj B

If I make archives of Obj A and Obj B which are lets say AObj A and AObjB then will these two archive objects will be automatically related to each other or do I need to do something to relate them.



 
Hi,

I am working on a query where I have to count distinct values from inside query in related object using Group By and Having and use that value in main query.

For example :

select Firstname from Contact where Account.Name in (
SELECT Name
FROM Account
GROUP BY Name
HAVING Count(Id) = 1)

This query is throwing error : "Unknown error parsing query"
Hello,

I am using an inline VF page on a custom object page layout to calculate current location coordinates of user. Inline VF page calls an Apex Class and updates Geolocation fields in Custom Object with current location coordinates. Since it is inline VF page so everything happens behind the scenes. Is there any way to reload the Detail page from where VF page was triggered automatically once it has calculated the current location coordinates.
 
Hello,

I am working on an application which displays markers on Goole maps. Info window of markers display person details such as name, address and phone number. When we click on name, detail page of person opens up which is working perfect. I want to have functionality that when we click on phone number, it should ask permission to dial that number just like it happens when you click phone number in salesforce 1.
 
I have added Google maps via Visual Force page in Account Page Layout to display location of account on map and it is working absolutely fine. I want to add same Visual Force page as link on account page layout. For this, I have created a new formula field and used HYPERLINK funtion as:

HYPERLINK("https://c.na24.visual.force.com/apex/LocateAccount?id={!Account.ID}", "map")

but this link is not working and throwing error message : Id value is not valid for the Account standard controller

when I manually add ID value to URL, then it displays location correctly like :

HYPERLINK("https://c.na24.visual.force.com/apex/LocateAccount?id=0011a00000Bw8o5", "map")

Is there anyway to make it dynamic so that it picks the ID for current account.

 
Can anyone help me with a simple sample code in Visual Force which uses REACT. I am trying to use react in VF but it is not rendering any component. 
Hello,

I have made a VF page and added it to Global Actions. This page shows data from couple of objects. I want this page to rotate when we rotate mobile screen while viewing this page in Sales Force 1. Is there anything I should add to my VF page. I am using HTML, APEX, JQUERY, BOOTSTRAP and VF is my page. 
Hello,

This is the trailhead questions which I am trying to solve :

Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.


Here is my code :

public class StringArrayTest {
    public static List <String> generateStringArray (Integer n) {
       List<String> List1 = new List<String> ();
        for(Integer i=0;i<n;i++) {
          List1.add('\'Test'+ i+'\'' );
  }
        System.debug(List1);
        return List1;
    } 

}


I am getting following error :

Challenge not yet complete... here's what's wrong: 
Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.


I tried it many times but I am not able to solve this problem. Please help. 



 
Hi, as a part of Trailhead challenge, I want to insert a ' before and after value in list. My line of code is :

List1.add(''' +'Test'+ i +''' );

This is throwing error message that : expecting a right parentheses, found ' +'. Could you please suggest what could be done.
Line of code : List1.add( 'Test'+ i ); is working fine. 
I am getting error message while solving this challenge in Trailhead :

To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).Name the validation rule 'Contact must be in Account ZIP Code'.
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)

Error Message is :  There was an unhandled exception. Please reference ID: HKIZNLVZ. Error: Trailhead::TrailheadTimeOut. Message: Trailhead.view: failed to get a 200 response. Made 3 attempts each resulting in a 403 or 500 failure for url challenges?key=%5B%22trailhead.challenge.validation_rules.en.us.192%22%5D.

I am not sure what went wrong here.
My Validation Rule is on Contact Object  :

  AND ( NOT(ISBLANK( Account.Name)),
( MailingPostalCode <> Account.ShippingPostalCode))

Can anyone please help with this.
Hello,

I was going throught Trailhead tutorial for Sales Force and under Data Security I found this challenge to,

"Create a 'Account Reviewer' profile which should only have read access to the Account object (and no access to any other object in the Org)."

When I am creating Account Reviewer profile, it is by default linked to all the objects. I am not able to see any Edit button while going inside Account Reviewer profile and select only Account object.

Can anyone please help me !!!
 
Hi All,

I created a class which selects live sessions from AuthSession object filtering on the basis of createddatetime and terminate those sessions. When I created test class, I am not able to write any data in AuthSession object. Any idea or way to populate some data in AuthSession object and create some sessions with different createddatetime. 

Any help is greatly appreciated. 
Hello,

This is the trailhead questions which I am trying to solve :

Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.


Here is my code :

public class StringArrayTest {
    public static List <String> generateStringArray (Integer n) {
       List<String> List1 = new List<String> ();
        for(Integer i=0;i<n;i++) {
          List1.add('\'Test'+ i+'\'' );
  }
        System.debug(List1);
        return List1;
    } 

}


I am getting following error :

Challenge not yet complete... here's what's wrong: 
Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.


I tried it many times but I am not able to solve this problem. Please help. 



 
I am getting error message while solving this challenge in Trailhead :

To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).Name the validation rule 'Contact must be in Account ZIP Code'.
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)

Error Message is :  There was an unhandled exception. Please reference ID: HKIZNLVZ. Error: Trailhead::TrailheadTimeOut. Message: Trailhead.view: failed to get a 200 response. Made 3 attempts each resulting in a 403 or 500 failure for url challenges?key=%5B%22trailhead.challenge.validation_rules.en.us.192%22%5D.

I am not sure what went wrong here.
My Validation Rule is on Contact Object  :

  AND ( NOT(ISBLANK( Account.Name)),
( MailingPostalCode <> Account.ShippingPostalCode))

Can anyone please help with this.
Hi,

I want to create duplicate copy of an object in Salesforce since we need to archive some data into duplicate object. Is there a better way to do this without using third part app from app exchange. I tried it using Force.com IDE but it is getting errored out while saving to server. 
Hi,

I am working on a query where I have to count distinct values from inside query in related object using Group By and Having and use that value in main query.

For example :

select Firstname from Contact where Account.Name in (
SELECT Name
FROM Account
GROUP BY Name
HAVING Count(Id) = 1)

This query is throwing error : "Unknown error parsing query"
Hello,

I am working on an application which displays markers on Goole maps. Info window of markers display person details such as name, address and phone number. When we click on name, detail page of person opens up which is working perfect. I want to have functionality that when we click on phone number, it should ask permission to dial that number just like it happens when you click phone number in salesforce 1.
 
I have added Google maps via Visual Force page in Account Page Layout to display location of account on map and it is working absolutely fine. I want to add same Visual Force page as link on account page layout. For this, I have created a new formula field and used HYPERLINK funtion as:

HYPERLINK("https://c.na24.visual.force.com/apex/LocateAccount?id={!Account.ID}", "map")

but this link is not working and throwing error message : Id value is not valid for the Account standard controller

when I manually add ID value to URL, then it displays location correctly like :

HYPERLINK("https://c.na24.visual.force.com/apex/LocateAccount?id=0011a00000Bw8o5", "map")

Is there anyway to make it dynamic so that it picks the ID for current account.

 
Can anyone help me with a simple sample code in Visual Force which uses REACT. I am trying to use react in VF but it is not rendering any component. 
Hi folks
Not great at javascript. Also newbie with Salesforce1 mobile. Here's my problem. Trying to create an onClick button that passes the contents of an input field (entered on a custom visualforce SF1 page) as the 'mailto' email address. I want to add a set subject line and body and then send this email on the click of a button on my custom mobile vf page.

I have created a link in js which does everything EXCEPT bring in the email address from the input field. I may be using the wrong syntax for a random input field but here's what I'm using <input type="text" id="email"/>.  I want to get this into a variable that I can use for the 'to' address.


E.g.  
var email (here's where I need my incoming email from the input field)
var subject = ('My permanent subject line');
var body = ('My permanent body contents');

document.write('<a href="mailto:' + email + '?subject=' +subject+ '&body=' +body+ '">' + 'Click here to send email as well' + '<'+'/a>');

As you can see I've made this a link in the interim that 'works' for what it does, but does not answer my missing enterable email problem.

What I really want to do then is have an onClick button that will activate the above instead of a link.

If you can help me with best practices for this it will go a long way as I can use the principles to apply to my further investigation and development.

Thanks
Hello,

This is the trailhead questions which I am trying to solve :

Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.


Here is my code :

public class StringArrayTest {
    public static List <String> generateStringArray (Integer n) {
       List<String> List1 = new List<String> ();
        for(Integer i=0;i<n;i++) {
          List1.add('\'Test'+ i+'\'' );
  }
        System.debug(List1);
        return List1;
    } 

}


I am getting following error :

Challenge not yet complete... here's what's wrong: 
Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.


I tried it many times but I am not able to solve this problem. Please help. 



 
Hi, as a part of Trailhead challenge, I want to insert a ' before and after value in list. My line of code is :

List1.add(''' +'Test'+ i +''' );

This is throwing error message that : expecting a right parentheses, found ' +'. Could you please suggest what could be done.
Line of code : List1.add( 'Test'+ i ); is working fine. 
I am getting error message while solving this challenge in Trailhead :

To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).Name the validation rule 'Contact must be in Account ZIP Code'.
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)

Error Message is :  There was an unhandled exception. Please reference ID: HKIZNLVZ. Error: Trailhead::TrailheadTimeOut. Message: Trailhead.view: failed to get a 200 response. Made 3 attempts each resulting in a 403 or 500 failure for url challenges?key=%5B%22trailhead.challenge.validation_rules.en.us.192%22%5D.

I am not sure what went wrong here.
My Validation Rule is on Contact Object  :

  AND ( NOT(ISBLANK( Account.Name)),
( MailingPostalCode <> Account.ShippingPostalCode))

Can anyone please help with this.
Hello,

I was going throught Trailhead tutorial for Sales Force and under Data Security I found this challenge to,

"Create a 'Account Reviewer' profile which should only have read access to the Account object (and no access to any other object in the Org)."

When I am creating Account Reviewer profile, it is by default linked to all the objects. I am not able to see any Edit button while going inside Account Reviewer profile and select only Account object.

Can anyone please help me !!!