Validation Rule: Initial(s) of customer - validation

I’m looking for some help with creating a validation rule.
Is is for a custom field on the Contact page called Initial.
Here I would like to display the initial(s) of a contact in the follow way:
J.S.K.
The initials are only the fist name and middle names.
So only capital letters and dots between the letters. We assumed that the max amount of initials should be 7.
Does anybody know how to create this is Salesforce Lightning?

Related

Laravel: Pivot Table, ManytoMany

I have been stuck on this since May 2020. I don't know how to move forward with the project. Any link or guidance would be very much appreciated. I'm trying to create a very simple rental system.
I have a Customer table: id, Name, Barcode
Another one is Item table: id, Name, Barcode, OnLoan
I'm trying to create a Form where there is a search box for Customer and search box for the Items. When the customer barcode is found and item barcode is found, you can fill in the Date Loaned and Date Due and click submit.
In the Item table, the OnLoan needs to be set to 1.
How do we do this please? Any link or keywords to help me on my way would be really great.
I have been googling and found out about onetomany, manytomany, pivot, scope, repositories. It's very overwhelming, i'm trying to go over them one at a time.

How rename description of Stripe subscription invoice line item from "trial period"

I have a plan for which I generate subscriptions with trial periods.
Stripe is generating invoices with a line item of 0$ for this trial period, with Trial period for <my_plan_name> as description. I would like to rename this description because my customers are French (and you know, we French people don't speak very well English but that's another story).
When I'm trying to update the item description
Stripe::InvoiceItem.update("sli_xyz",
{ description: "Essai..." })
I'm getting error Stripe::InvalidRequestError: When passing an invoice's line item id, you may only update tax_rates.
I can't delete such a line item neither because this is a subscription item and I can't remove the description neither.
What am I missing here ? Is there a way to resolve that ?
There are two Stripe concepts here: an Invoice and InvoiceItem.
InvoiceItems are essentially line items of individual items/services that is being tendered. An Invoice can contain many InvoiceItems. Imagine an Invoice is the complete receipt, and InvoiceItem is the individual grocery item.
Normally, you can update the InvoiceItem either before you attach to an Invoice, or even after you attach it, before the Invoice is finalized/closed (a.k.a. paid for by the customer).
Stripe does not allow you to update the description of InvoiceItems that are closed/finalized, because as a merchant, invoice is a record of what you sold (and receipting) to the customer, and once the invoice paid by the customer, you cannot change it.
Imagine if your invoice was originally for 50 beers, but after they pay for it, you decide to update the invoice to say 5 beers! How is that fair to your customers?
Your only solution is to make sure the description is defined properly in French for your French customers before issuing the invoice going forward into the future.
There is no way to fix this for past InvoiceItems.

Change report locale for each record?

I have customers from many countries, and for each one I need to generate a page with data on it.
In my report I have a similar query: SELECT Name, Address, CodLanguage ... FROM Customers
For each record of this query, I want to generate a page in Jasper Reports with customer data in their respective language (I know its language through this flag CodLanguage).
I want change report language for each customer page (each record). Can i do this using report parameter locale? Or changing some variable for each record? Has anyone had a similar situation? Have any idea what can be done?
Example
I need translate the labels: Name, Address, City, Phone Number and Country in 10 different languages, according to the customer's country language.
This example is only a simplification. I will generate between 3 and 6 report pages for each customer, with many other data.
Thanks!
As far as I can tell, this is not possible using any of the standard resource references:
$R{resource.bundle.property}
msg() function
str() function
For each record, supply the corresponding locale (or determine it based on other data, like the country and city -- chances are Quebec, Canada would be French [fr_CA] while Toronto, Canada would be English [en_CA]).
Once there's a map of locales to locations, use a ResourceBundle (or MessageFormat?) to translate the key for a particular label.
Create a number of resource bundle files with translations for the various labels. The file names must have a suffix that corresponds to the predetermined locale (e.g., Bundle_fr_CA.properties).
Change the label from static text to an expression. The expression instantiates a new resource bundle to look up the key (e.g., "city.name") for its translated value, such as:
ResourceBundle.getBundle("Bundle", new Locale("en", $F{country})).getString("city.name")
How the "en" is determined will be a bit of a chore, unless you can alter the database to get the user's language preferences. This means you'll also have to create a resource bundle for every language/country combination, which can be automated.

validate and match the zip code with bill/ship country in magento checkout

I want to validate the zip code as per bill/ship country in magento checkout process.
entered bill/ship country should matches the entered zipcode.
If the entered zipcode and country did not match - customer should not be able to save the address and appropriate error message should be displayed.
Example:- customer entered zip code 12345 and selected country as US.
Then it should display the message "Zip code do not match with selected country."
can anyone suggest me , how can i validate the zip as per country ?
Can i use the google API to validate the zip code ?
What portion of magento file i need to customize ?
If you want to achieve this functionality, first you need to map the zipcodes with countries or use any plugin for it. Then, define a model or table for it. Then, during checkout make an ajax call from zipcode field to your controller, call your model there and then check the pincode. Based on your comparison, return the result and display what you want to.

Magento: Add New Field to Credit Card Form

I'm trying to modify the credit card form to add some new custom fields named "Bank Name" and "Bank Phone Number" and it seems this cannot be done through the back-end.
I've searched the web and on here but I haven't been able to find anything in reference on how to add a new custom field to the credit card form. I would think it's almost the same as adding a new field to the customer registration form but I have no clue what to do database wise.
If anyone has anything I can use to work on this, I'd greatly appreciate it.
You should start by informing which version of Magento you are using and which methods you have already tried.
Without knowing that it is hard to help you, but you might want to try this possible solution, this one, or even one of these modules: Checkout Fields Manager or ADDITIONAL CHECKOUT ATTRIBUTES. If none of the above work, try this search.
No, Magento admin panel will not add custom columns for you. You need to do it yourself.
First, you need to edit the .phtml file to include these two fields to show up in frontend.
Second, you need to add two new columns (with same name as your fields, explained later) in relevant DB table (i guess sales_flat_order_payment). But that will affect for all payment methods, so define it something like VARCHAR(255) NULL.
Third, when Magento saves the CC info, you need to check if it is saving whole data array, then your field's name posted will match your table field and get inserted automatically. Else you need to edit it.
Also, next time please post some code, atleast something you have tried.

Resources