Forum Discussion
Country column format
You can fix this issue by adding external site domain from where you are using images (in JSON) in HTML Field Security settings of your SharePoint site - Allow or restrict the ability to embed content on SharePoint pages
More information at: Hyperlink/Picture Column suddenly breaks external images in Gallery/Card Designer
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
slyth27 Sstein2310 I have tried it on our SharePoint site from my end and it is working fine.
Output:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Abhijit_Swami1716Aug 16, 2023Copper Contributor
Could you please share json code for the aboveganeshsanap
- ganeshsanapAug 16, 2023MVP
Abhijit_Swami1716 Here is the code I used:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "inlineEditField": "[$Country]", "children": [ { "elmType": "img", "attributes": { "src": "=if(@currentField,('https://www.worldometers.info/img/flags/' + if(indexOf(@currentField,'Afganistan')==0,'af', if(indexOf(@currentField,'Albania')==0,'al',if(indexOf(@currentField,'Alemania')==0,'gm', if(indexOf(@currentField,'Argelia')==0,'ag', if(indexOf(@currentField,'Argentina')==0,'ar', if(indexOf(@currentField,'Andorra')==0,'an', if(indexOf(@currentField,'Antigua y Barbuda')==0,'ac',if(indexOf(@currentField,'Arabia Saudita')==0,'sa',if(indexOf(@currentField,'Zambia')==0,'za',if(indexOf(@currentField,'Zimbabue')==0,'zi','no')))))))))) + '-flag.gif'),'')", "title": "" }, "style": { "max-width": "23px", "padding": "0 6px 0 0" } }, { "elmType": "span", "txtContent": "@currentField" } ] }I have added conditions for only few countries in above JSON. You can add more conditions as per your requirements.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Abhijit_Swami1716Aug 17, 2023Copper ContributorThank you!