Comments (19)
I forgot to say, I have this code working in other dev orgs and tests run fine, this is when I try to deploy to a new dev org, is there something I need to update/change with new Salesforce releases?
from twilio-salesforce.
https://help.salesforce.com/apex/HTViewSolution?id=000213516&language=en_US
If you have accepted the critical update on those orgs for "Predictable Iteration Order for Apex Unordered Collections", then the test classes will fail because the order no longer matches what is returned. In these cases I would re-order the parameters in the MAP in most of the cases, until we can patch the code.
This is re-ordered to match the URL.
map<string,string> params=new map<string,string>();
params.put('AreaCode','510');
params.put('Contains','51034*****');
from twilio-salesforce.
Thanks for your response it helped us alot, we followed your steps and the errors are gone
from twilio-salesforce.
I need to add that we had to add a validation for the orgs that hasn't accepted the update yet in order to work in both scenarios.
static testMethod void testGenerateParamString() {
Boolean firstKey = true;
Boolean isOrdered = false;
Map<String, String> ordMap = new Map<String, String>{'a' => 'b', 'c' => 'd'};
for(String key: ordMap.keySet()){
if(ordMap.get(key) == 'b' && firstKey){ isOrdered = true; }
firstKey = false;
}
if(isOrdered){
//Update accepted
System.assertEquals('', generateParamString(new Map<String,String>()));
System.assertEquals('a=b', generateParamString(new Map<String,String> {'a'=>'b'} ));
System.assertEquals('foo=bar&cat=dog', generateParamString(new Map<String,String> {'foo'=>'bar', 'cat' => 'dog'} ));
System.assertEquals('a=b&c=d&e=f', generateParamString(new Map<String,String> {'a'=>'b', 'c'=>'d', 'e'=>'f' } ));
System.assertEquals('split+key1=split+val1&split+key2=split+val2', generateParamString(new Map<String,String> {'split key1'=>'split val1', 'split key2'=>'split val2'} ));
}else{
//Update not accepted
System.assertEquals('', generateParamString(new Map<String,String>()));
System.assertEquals('a=b', generateParamString(new Map<String,String> {'a'=>'b'} ));
System.assertEquals('cat=dog&foo=bar', generateParamString(new Map<String,String> {'foo'=>'bar', 'cat' => 'dog'} ));
System.assertEquals('e=f&c=d&a=b', generateParamString(new Map<String,String> {'a'=>'b', 'c'=>'d', 'e'=>'f' } ));
System.assertEquals('split+key2=split+val2&split+key1=split+val1', generateParamString(new Map<String,String> {'split key1'=>'split val1', 'split key2'=>'split val2'} ));
}
}
from twilio-salesforce.
Please reopen this and change
if(ordMap.get(key) == 'b' && firstKey)isOrdered = true;
to
if(ordMap.get(key) == 'b' && firstKey){ isOrdered = true; }
This is the error that created a major security hole in OSX, and best-practice is to use curly brackets for every if statement, even on one line.
from twilio-salesforce.
I'd be happy to review a pull request for that :)
from twilio-salesforce.
re-opened issue and updated the comment and our code, thanks for the heads up
from twilio-salesforce.
I have sent the request
from twilio-salesforce.
Thank you. Apologies for asking someone else to make the change (faux pas, I know) but I wasn't at a machine that would let me do it myself. Go team!
from twilio-salesforce.
no prob, I just haven't had enough time to figure out how to remove whitespacing and indentation :P
from twilio-salesforce.
Hi,
I'm new to this twilio stuff but when I'm trying to deploy I'm getting the same errors in the salesforce production and also we have the update our org with critical updates.
Can you pls let me know on which class I have to update these Lines:
map<string,string> params=new map<string,string>();
params.put('AreaCode','510');
params.put('Contains','51034*****');
from twilio-salesforce.
Here is the test class failures:
from twilio-salesforce.
Hi,
You need to modify both files: Twilio_TestApplication and Twilio_TestPhoneNumbers
from twilio-salesforce.
Is it possible if we can get an updated managed package with this bug fix?
from twilio-salesforce.
We currently aren't releasing managed packages for salesforce.
from twilio-salesforce.
Sorry, I meant unmanaged package. Is v4.0.0 with this bug fix?
from twilio-salesforce.
The latest version has many updates in it, including support for some of our new APIs, and re-ordering the test data expected to the Salesforce Unordered Lists patch which is auto activated on 6/5 by salesforce. However, it also has some restructuring of classes so if you have already installed and are leveraging an older version I would advise you to update the test class yourself versus using v4.0.
from twilio-salesforce.
To Fix the issue quickly:
-
Re - Order Map values in Twilio_TestApplication class near line no. 130 and 219 as given below:
params.put('VoiceMethod','POST');
params.put('FriendlyName','Testapp1'); -
Re - Order Map values in Twilio_TestPhoneNumbers class near line no. 264 as given below:
params.put('AreaCode','510');
params.put('Contains','51034*****'); -
Comment the 5 line code from line no. 271 to 275 in TwilioCapability class and all the error will be gone.
from twilio-salesforce.
@saamabbas very clear on the directions listed above, wanted to comment that this fix worked perfectly.
from twilio-salesforce.
Related Issues (20)
- Add Enqueue verb to TwiML generator HOT 1
- Missing deleteApplication method.
- Installation HOT 8
- ant deployTwilio failure [Twilio_TestConference.testTwilioParticipants_get -- TwilioRestException: Script-thrown exception] HOT 4
- Script thrown Exception error on TwilioRestException during deployment using changesets. HOT 1
- Need to improve unit test coverage
- Call redirect is throwing exception 404 even though uri is valid HOT 4
- Putting Client Softphone inbound call into a conference hangs up the call after 3 beeps.
- TwilioRestException: Script-thrown exception HOT 11
- Script-thrown Exception in TwilioSMS class
- Documentation out of date. (uses SMSMessage class in example)
- Can't clone the repository. HOT 1
- apex failure when trying the tutorial twilio-salesforce dialer HOT 1
- Twilio_TestPhoneNumbers: Test failure preventing deployment
- Outbound Conference Call Feature- Agent Conference HOT 1
- Issue in Installing Twilio Salesforce Helper Library
- Twilio/ Salesforce Softphone not working
- Dual install 'Twilio for Salesforce' package with GitHub repo 'twilio-salesforce'
- How do I Add a Line Break in my SMS Message? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twilio-salesforce.