I have trigger Code:  Trigger AutoEmailsending on Order (after update)  {     Map&lt;Id,Order&gt; Orderdetail = new Map&lt;Id,Order&gt;();     Set&lt;Id&gt; Accountid = new Set&lt;Id&gt;();     for(order or1 : Trigger.new)     {         if(or1.Status == 'Submitted' &amp;&amp; (or1.Subtype__c =='Offer' || or1.Subtype__c =='ASP'))         {             Orderdetail.put(or1.id,or1);             Accountid.add (or1.accountid);         }     }     List&lt;Attachment&gt; Attachmentlst = [Select Id,                                              ParentId,                                               Name,                                              BodyLength,                                              Body,                                              Description                                          From Attachment                                          where ParentId=:Orderdetail.keyset()];       for (attachment attachmentlst1 : attachmentlst )     {          String Emailaddress = UserInfo.getUserEmail();        Profile[] profiles = [select id from profile where name in ('Sales Rep - France','Sales Rep - Italy')];          String[] values = new String[0];          for(Profile Id: profiles)         values.add(Order_Configuration__c.getInstance(id));           //string SellingOfficePhone = Order_Configuration__c.getInstance().Selling_Office_Phone__c;          String SellingOfficePhone = Order_Configuration__c.getInstance(UserInfo.getProfileId()); String Market = Accountmap.get(Orderdetail.get(attachmentlst1.ParentId).accountid).Market__c;         CCaddress.add(emailaddress);         if(CustomerServiceEmail !=null)         CCaddress.add(CustomerServiceEmail);           Messaging.SingleEmailMessage mail = new                   Messaging.SingleEmailMessage();         mail.setToAddresses(Toaddress);         mail.setCcAddresses(CCaddress);         if(Orderdetail.get(attachmentlst1.ParentId).Subtype__c =='Offer' || Market=='FR')         {             mail.setSenderDisplayName('Trade Order-FR');              ResourceName = 'TC_for_France';             TCname = 'CONDITIONS_GENERALES_DEVENTE.pdf';                     strHtmlBody ='Hi,&lt;br/&gt;&lt;br/&gt;';                         strHtmlBody+=+SellingOfficePhone +                       '                    mail.setHtmlBody(strHtmlBody);         }         else         {                  if(!String.isBlank(SellingOfficePhone))                 {                     {                       strHtmlBody +=                         +SellingOfficePhone+                      }                 }                  mail.setHtmlBody(strHtmlBody);         }            Messaging.Emailfileattachment efa = new Messaging.Emailfileattachment();         efa.setFileName(attachmentlst1.Name);         efa.setBody(attachmentlst1.Body);         fileAttachments.add(efa);         Messaging.Emailfileattachment efa1 = new Messaging.Emailfileattachment();         efa1.setFileName(TCname);         efa1.setBody(resources.get(resourceName));         fileAttachments.add(efa1);         mail.setFileAttachments(fileAttachments);         Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});      } }   I have a order configuration Custom setting object is there and selling office phone field is there inside order configuration Custom setting object and the value is different for two profiles how do i access the profile value for selling office of custom setting in If and another profile value for selling office in else statement I have Tried so many times ,Anyone Guide me for the Answer
I have created the custom setting with the hierarchy type    I have added some fields to the custom settings  phone field is added to the custom settings  custom setting Name:Order_Configuration__c  Phone :12345 - one profile  phone:456798 - another profile   Is it possible to access the different values for different profiles in custom settings using apex trigger code
How can you tell when a sunset is going to be spectacular? I have a spot that I like to take sunset pictures. I find that the most spectacular moments last for only maybe 5-10 minutes. What I would like to do is know about a half hour before that a sunset is going to be spectacular, so I can grab my camera, tripod, walk 5-10 minutes to my sunset spot, set up, and have a few minutes to spare in case something happens. However, I've often missed really cool sunsets, because I just don't know when to photograph them. How can you tell beforehand when a sunset is going to be spectacular? Thanks! Kant introduces the notion of the noumenon in his critical philosophy; he also later demonstrates in his system that solipsism isn't possible.   Is the introduction of the noumenon essential to this demonstration, and thus justifies it's introduction? If $f'$ is bounded, then $f$ is uniformly continuous Let $f\colon(a,b) \to \mathbb R$ be differentiable and suppose that there exists an $M&gt;0$ such that $|f&#39;(x)| \leq M$ for all $x$ in $(a,b)$. Prove that $f$  is uniformly continuous. I am having issues with input in VMware Workstation Player 12 in windowed mode or on multiple screens. When typing something in the VM and moving mouse cursor out of the VM without clicking on anything (for example on the second screen with host OS), the typing in that VM stops until I move the cursor back into VM.  Can this feature be disabled somehow so I am able to type in the virtual machine even when cursor is outside of it?  Both guest and host are Win10 x64 OS. interaction between mathematical structures From a physicist's perspective there are several situations in which somehow arbitrary choices of mathematical structures can be made. One can describe a system from different perspectives, etc. without changing anything in the physical properties. (see gauge invariance, picture changing etc.) In the situation when these choices impose a mathematical structure one has limitations in the subsequent choices (are these limitations physical???). However, there are situations when this prescription does not hold. The best example is in this case the Black-Hole complementarity principle (if it is well defined in the first place). So, the question about how mathematical structures "interact" in a logical way is not a bad one. Again: what is the interaction between, say, locality and Hausdorff-ity in the case of a black hole? Or what is the true relation between metrizability and hausdorff-ity of a space in the context of a black hole? The question about how mathematical structures assigned (innocently) at some point interact in different situations is in my opinion a quite relevant one... Is Dyson Sphere a stable construction? Suppose that a star is encompassed by a . Do we need a position control system for the Dyson Sphere to keep its origin always aligned with the center of the star? Will it stay aligned itself and automatically neutralize small perturbational forces? Or will a small perturbation remove it out of the orbit of the star, so that it will be eventually destroyed and swallowed by the star? Do you capitalize both parts of a hyphenated word in a title?  "My Ex-Wife Hates Me"  or  "My Ex-wife Hates Me" Crop a big picture into several small size pictures Is there a a way with GIMP editor to crop a big picture into several small equal sized pictures? So when all those small pictures connected in order would make a big picture. How can I set mouse sensitivity, not just mouse acceleration? No sound (speakers/jack) + microphone's dead after spilling water When functions commute under composition Flames with no gravity? I was watching  today, and noticed this: in some moment the space station changed orbit and the people inside experienced zero-gravity. At that moment, a candlestick passed floating in the air, with the candles burning ().   But in our environment the flames go upward because the hot air is less dense, and that effect should disappear when no gravity is present, am I right? How would a candle flame look then? How do I properly use the "Not an Answer" flag? What is the "Not an Answer" flag and what is its purpose? When should I use this flag? When should I not use this flag? But I'm still not sure if I'm using the flag correctly... An answer is "Not an Answer", but the flag was declined or disputed!   See also: Why do we use residuals to test the assumptions on errors in regression? Suppose that we have a model $Y_i = \beta_0 + \beta_1X_{i1} + \beta_2X_{i2} + \dots + \beta_kX_{ik} + \epsilon_i$.  Regression has a number of assumptions, such as that the errors $\epsilon_i$ should be normally distributed with mean zero and constant variance. I have been taught to check these assumptions using a normal QQ plot to test for normality of the residuals $e_i = Y_i - \hat{Y}_i$ and a residuals vs. fitted plot to check that the residuals vary around zero with constant variance.  However, these tests are all on the residuals, not the errors.  From what I understand, the errors are defined as the deviation of each observation from their 'true' mean value. So, we can write $\epsilon_i = Y_i - \mathbb{E}[Y_i]$. These errors cannot be observed by us. *  My question is this: how good of a job do the residuals do in mimicking the errors?   If the assumptions appear to be satisfied on the residuals, does this mean they are satisfied on the errors too? Are there other (better) ways to test the assumptions, like fitting the model to a testing dataset and getting the residuals from there?    * Furthermore, does this not require that the model is specified correctly? That is, that the response really does have a relationship with the predictors $X_1, X_2,$ etc. in the way specified by the model.  If we are missing some predictors (say, $X_{k+1}\ \text{to}\ X_p$), then the expectation $\mathbb{E}[Y_i] = \beta_0 + \beta_1X_{i1} + \beta_2X_{i2} + \dots + \beta_kX_{ik}$ would not even be the true mean, and further analysis on an incorrect model seems pointless.  How do we check whether the model is a correct one? Subgroups of $U(n)$ isomorphic to a direct sum of cyclic groups Why does Oracle 9i treat an empty string as NULL? How to convert an instance of std::string to lower case How to recognise/thank great cabin crew? Those of us who fly a lot will know that there is a bit of a variety in cabin crew. Some (sadly more common on certain airlines) do the very bare minimum to ensure a safe flight, but nothing more. Many (especially on airlines noted for good customer service) provide a good service.  Every so often though, you come across a flight crew who go the extra mile. These are the ones always friendly, always helpful, always thinking ahead and solving the problem before it has happened. One moment they're serving you your drink, the next reassuring a little old lady about the flight, the next magicing a colouring book to turn an impending toddler crisis into a happy small child, then answering queries on arrivals and immigration for a first time travaller, then back to offer you a top up of what you're drinking (which they've remembered exactly). Not very often found, but very much appreciated when you happen across them on your travels!  In the case when you do luck out and find yourself on a flight with a great cabin crew (who go well beyond what you normally experience as "good" on that airline/kind of airline), is there a standard/common way to recognise them at the end of the flight? Not just to thank them then and there, but also to let the airline know that this person/group are what the rest of their staff should be aspiring to. Is there any standard way, or does it vary entirely by carrier? Intuitive understanding of the derivatives of $\sin x$ and $\cos x$ One of the first things ever taught in a differential calculus class:   The derivative of $\sin x$ is $\cos x$. The derivative of $\cos x$ is $-\sin x$.   This leads to a rather neat (and convenient?) chain of derivatives:   sin(x) cos(x) -sin(x) -cos(x) sin(x) ...   An analysis of the shape of their graphs confirms some points; for example, when $\sin x$ is at a maximum, $\cos x$ is zero and moving downwards; when $\cos x$  is at a maximum, $\sin x$ is zero and moving upwards.  But these "matching points" only work for multiples of $\pi/4$.  Let us move back towards the original definition(s) of sine and cosine:  At the most basic level, $\sin x$ is defined as -- for a right triangle with internal angle $x$ -- the length of the side opposite of the angle divided by the hypotenuse of the triangle.  To generalize this to the domain of all real numbers, $\sin x$ was then defined as the Y-coordinate of a point on the unit circle that is an angle $x$ from the positive X-axis.  The definition of $\cos x$ was then made the same way, but with adj/hyp and the X-coordinate, as we all know.  Is there anything about this basic definition that allows someone to look at these definitions, alone, and think, "Hey, the derivative of the sine function with respect to angle is the cosine function!"  That is, from the unit circle definition alone.  Or, even more amazingly, the right triangle definition alone.  Ignoring graphical analysis of their plot.  In essence, I am asking, essentially, "Intuitively why is the derivative of the sine the cosine?" Prove that $f'(0)$ exists and $f'(0) = b/(a - 1)$ Problem:   If $f(x)$ is continous at $x=0$, and $\lim\limits_{x\to 0} \dfrac{f(ax)-f(x)}{x}=b$, $a, b$ are constants and $|a|&gt;1$, prove that $f'(0)$ exists and $f'(0)=\dfrac{b}{a-1}$.   This approach is definitely wrong:    \begin{align} b&amp;=\lim_{x\to 0} \frac{f(ax)-f(x)}{x}\\ &amp;=\lim_{x\to 0} \frac{f(ax)-f(0)-(f(x)-f(0))}{x}\\ &amp;=af'(0)-f'(0)\\ &amp;=(a-1)f'(0) \end{align}  I will show you a case why this approach is wrong:     \[f(x)= \begin{cases} 1,&amp;x\neq0\\ 0,&amp;x=0 \end{cases}\]   $\lim_{x\to0}\dfrac{f(3x)-f(x)}{x}=\lim_{x\to0} \dfrac{1-1}{x}=0$   but $\lim_{x\to0}\dfrac{f(3x)}{x}=\infty$,$\lim_{x\to0}\dfrac{f(x)}{x}=\infty$   Does anyone know how to prove it? Thanks in advance!